This is a respawn script I implemented in my game and im here giving it away to anyone that has respawning issues this works 100% you just have to implement your own timer I disabled mine for debugging purposes so enjoy this script… please do give credit to me for the code feel free to use for any purpose though.
var PlayerObject : GameObject;
var playerReplacement : GameObject;
var timer = 0;
function Update ()
{
//Creates an array of all players in the game
var players: GameObject[] = GameObject.FindGameObjectsWithTag("Player");
//Iterates through the array and find its own prefab ignoring
//all other players
//then assigns the target to the array position gameobject
for(player in players)
{
if( player.networkView.isMine)
{
PlayerObject = player;
}
}
if(PlayerObject == null)
{
Network.Instantiate(playerReplacement,
transform.position, transform.rotation,0);
timer = 0;
}
}