Change scene when all GameObjects tagged "tag" are destroyed.

Hi. So I have a working script that deletes cubes tagged “coin” when an object tagged “player” collides with it, but I have been trying for a while, and cannot succeed.
How do I make it so that when all GameObjects tagged “Coin” are deleted, it will change scene with Application.LoadLevel or something?

Thanks, James.

If the script for my coin-pickup script is needed, here it is.

#pragma strict

function OnTriggerEnter (info : Collider)
{
if (info.tag == “Player”)
{
Destroy(gameObject);
}
}

Thanks in advance.

in your Update function you should pass a conditional, as long as that script has access to a value that decreases based on your coin collection, or indeed increase can be used also, like so…
public int coinsCollected; //this would be public set to change up or down for every coin you collect.

then pass the conditional in Update() function

void Update()
{
if(coinsCollected >=10)
{
Application.LoadLevel("your level name"); //this will fire when your condition has passed
}

//...more of your code etc
}

You don`t have to use a string name for your level if you know the numbers (your first scene usually numerically equates to 0 for example)

PS, to keep it UnityScript(JS) just replace the “void” with “function”
Anyway, this is a start for you, we can go from here.
Take care bud.
Gruffy