Restarting game from last checkpoint.

Hello,
I’m making some basic platformer game and I have one issue. To control if my player dies I have gameobject with Destroyer method and then Application.LoadLevel().When player dies screen appears with restart button. What I want to acomplish is to when player pass checkpoint and dies I want him to be spawned in checkpoint location. I made some basic code to store player position but I have no idea what to do next.

public class Checkpoint : MonoBehaviour
{

	Vector3 playerPos;

	void OnTriggerEnter2D(Collider2D other)
	{
		if (other.tag == "Player") 
		{
			playerPos = other.transform.position;

		}
	}

}
`
`

You should not destroy your player, more likely disable renderer or trigger death animation and then reposition him.

To respawn, you almost got it.

In your player, where you have the death method add a Transform for respawn.

Then when you enter the trigger box:

void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "Player") 
    {
       other.gameObject.GetComponent<ComponentWithDeath>().respawn = this.transform; 
    }
}

And your death method is something like:

public Transform respawn = null;
IEnumerator Death(){
   float wait = 0;
   // Here get the guy dying in animation or else
   while(wait < 3){
       wait += Time.deltaTime;
       yield return null;
   }
   if(respawn != null){
      transform.position = respawn.position;
      transform.rotation = respawn.rotation; // Make sure the box is orientated to the right
   }
}

The method above will get the player to wait for 3s before being respawn. You will need to add more details, as for the health, maybe some blinking at first, and other things.