respawn script needed?

Here is my player respawn script but my player wont respaw now i dont know what seemes to be the problem anyone hove any ides how to make it work?

using UnityEngine;
using System.Collections;

public class LevelManager : MonoBehaviour {

public GameObject currentCheckpoint;

private PlayerController player;
public GameObject deathParticle;
public GameObject respawnParticle;

public float respawnDelay;
void Start(){
	player = FindObjectOfType<PlayerController>();
}
void Update()
{
}
public void RespawnPlayer()
{
	StartCoroutine ("RespawnPlayerCo");
}
public IEnumerator RespawnPlayerCo()
{

	Instantiate(deathParticle,player.transform.position,player.transform.rotation);
	player.enabled = false;
	player.GetComponent<Renderer>().enabled= false;
	Debug.Log ("Respawn Player");
	yield return new WaitForSeconds (respawnDelay);
	player.transform.position = currentCheckpoint.transform.position;
	player.enabled = true;
	player.GetComponent<Renderer>().enabled = true;
	Instantiate(respawnParticle,player.transform.position,player.transform.rotation);
}

}

Your script works perfectly.

Only issues I ran in to:

Null Reference exceptions

  • deathParticle, respawnParticle, currentCheckpoint. Are you seeing any null reference exceptions? are references set up? drag and drop prefabs on to your inspector variables or use resources.load to add particle prefabs to their variables.

respawnDelay

  • stayed at zero because the inspector serialized it at zero. is your issue not seeing a delay?