You can start by writing out the molecular formula of each molecule.
Aluminum (Al 3+) Phosphate (PO4 3-)
AlPO4
Nickel II (Ni 2+) sulfide (S 2-)
NiS
Aluminum Sulfide
Al2S3
Nickel Phosphate
Ni3(PO4)2
If you’re wondering, we get those charges by looking at the periodic table. The metals usually have a + charge based on their group number. The nonmetals usually - charge egual to 8 - their group number.
You then balance the ions by flipping the charges, dropping the signs, and adding them in as subscripts.
Now we can put it into an equation
AlPO4 + NiS —-> Al2S3 + Ni3(PO4)2
Balance by adding coefficients
2 AlPO4 + 3 NiS —-> Al2S3 + Ni3(PO4)2