Restart Level not working...

So, what I’m trying to do is,an exploding coin, that would restart the level when you colect it.
here is my code:

var coinExplosion : Transform;

function OnTriggerEnter (info : Collider) 
  if (info.tag == "Player")
  var effect = Instantiate(coinExplosion, transform.position, transform.rotation);
  yield WaitForSeconds(0.5) //Time for the explosion to end

The coin explodes and everything, but the level doesn’t restart…
Tell me if you need more info.
Thank you in advance,


You are destroying the gameObject, so it cannot wait for 0.5s because it is not there anymore! You need to rethink how you are going to call Application.LoadLevel

please format your code. You can do this by highlighting all your code, then clicking the 10101 button at the top of the edit window.