How to delay a respawn?

Hi, I want to respawn a gameObject (player) but I want it to respawn after a few seconds,I’m using the “yield WaitForSeconds()” to do this, but my problem is that after using it nothing happens, it doesn’t even reach my debug.log statement. If I take out the “yield WaitForSeconds()” the player respawns as I want, but when I put it back nothing happens. Heres part of the javascript which is in a gamebject that doesn’t ever get destroyed:

var player:GameObject;

function Update(){//this is the position of the undestroyable gameobject
transform.position=Camera.main.ScreenToWorldPoint( Vector3(Screen.width/2, Screen.height/2, 0) );
}

function respawn(){
Debug.Log("hey");
yield WaitForSeconds(1); 
Debug.Log("whaaat"); //this debug and the instantiantion doesn't happen 
Instantiate(player,Vector3(transform.position.x, transform.position.y,0), Quaternion.identity);
}

I have seen some other questions about how to delay the instantiation but the answers are pretty much the same method I’m using, my question is: why doesn’t anything happen after the yield? is there another method to do this?

Use

Invoke("respawn",2f); //this will call respawn fun after 2 sec

function respawn(){
Debug.Log("whaaat"); //this debug and the instantiantion doesn't happen
Instantiate(player,Vector3(transform.position.x, transform.position.y,0), Quaternion.identity);
}
}

call Invoke("respawn",2f) when your player dies