How would i add some code so when (Done){Some code here)} the fireworks particle emits on my flag?
Couldn’t you use a trigger to accomplish this? I am assuming here that the player has to reach a certain point to be considered “done”.
If I am wrong in my assumption let me know
No, i want it so when he collects the last coin, fireworks blast off around him one-shot and an audio going “Yaaaay”
You probably just need to keep a count of the coins collected so far. When you get to the target number (ie, all coins are collected) you can then start the fireworks. You may find it easier to instantiate a prefab with a particle system rather than switch on the emission from the script:-
var coins: int;
...
if (coinCollected) {
coins++;
}
...
if (coins == coinTarget) {
Instantiate(fireworks, flag.transform.position, Quaternion.identity);
}