Checkpoint help

Ok i’ve tried quite alot of different scripts for checkpoints , few have worked a few havnt , but heres my thing , every script auto respawns my character , how can i make it so when i press backspace i can then go back to checkpoint , same if i die , i stay dead till i press backspace. I’m not the best at scripting , i can edit little bits, if anyone is feeling generous, please wright me a script for this, thank you :slight_smile:

Player script :

public class PlayerScript : MonoBehaviour {

    Vector3 respawnPoint;
    bool dead;

    void Start()
    {
        respawnPoint = new Vector3(0,0,0); // STARTING POSITION
    }

    void Update () 
    {
        if(dead)
        {
            if(Input.GetKeyDown(KeyCode.Backspace))
            {
                transform.position = respawnPoint;
            }
        }

        if(Input.GetKeyDown(KeyCode.Backspace))
        {
            transform.position = respawnPoint;
        }

    }

    void checkpointPos(Vector3 checkpoint)
    {
        respawnPoint = checkpoint;
    }
}

Checkpoint Script :

public class CheckPoint : MonoBehaviour
{
    GameObject player;

    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
    }

    void OnTriggerEnter(Collider co)
    {
        if(co.gameObject.tag == "Player")
        {
            player.SendMessage("checkpointPos", transform.position);
        }
    }
}

Note that checkpoint script should be attached to a cube object that is large enough to cover all the space in the area checkpoint and that cube must have a box collider with “is trigger” enabled. Add rigidbody, too. Finally, make sure to remove its mesh renderer so that player doesn’t see it. Scripts could’ve been better but that’s what you get for free :slight_smile:

[Question answered, adding this to remove it from Unanswered list]