2D PlayerRespawn

#pragma strict

var Player : GameObject;
var spawnPoint : Transform;

function OnTriggerEnter(other : Collider){
	Destroy(other.gameObject);
	var P : GameObject = Instantiate(Player, spawnPoint.position, Quaternion.identity);
	var sf = Camera.main.GetComponent(SmoothFollow2);
	sf.target = P.transform;
}

I die in my 2D game but my camera stays where i died and my player doesnt respawn?

Don’t destroy the character, just move it to the spawn point position. This is faster anyway, and you won’t have to worry about changing the camera’s follow object.

You will have to reset things like any powerups yourself, but you won’t have to reset any other script’s access to the player (like a life counter, or in this case the camera follow object)

 function OnTriggerEnter(other : Collider){
        other.transform.position = spawnPoint.position;
 }