restart when dead

how can i make it so that when my player touches a collider with the tag Restart he teleports back to the start of the scene?

Vector3 StartingPosition;
Vector3 StartingForwardPosition;

void Start()

StartingPosition = transform.position;
StartingForwardPosition = transform.forward;

//If its a collider, use OnCollisionEnter
//If its a trigger, use OnTriggerEnter(Collider coll)
void OnCollisionEnter(Collision coll)
transform.position = StartingPosition;
transform.forward = StartingForwardPosition;

To answer your question, let us consider two separate aspects of the game. The first is “position”. Every game object (including your player) has a position in the 3D world. The position is given by a Vector3 which contains x, y and z values. If we assume that the start of the scene is at 0,0,0 then to “teleport” back to the start, you would execute the following code:

transform.position = Vector3(0,0,0);

It is assumed that this code is executed in the context of your player gameObject.

The next part of your question is detecting when a player collides with an object.

See the following:

At a high level, your will flag your Collider component as a “Trigger”. When your player game object enters the trigger, the OnTriggerEnter() callback on a script attached to your collided object will be called. This will serve as the indication that your player needs to be teleported back to the start of the scene using the transform.position technique described previously.