Falling off respawn

Greetings, I am currently creating a game where you have to jump from one cube to another and not fall off. I was wondering if there was any way that I could make it so the player respawns at the original spawn point after falling a little distance. Does anyone have scripts for my request?

Yeah like he said
Step1. Create a Cube scale it so that it covers the whole game arena then remove mehfilter nad mesh renderer component from it.

Add this script

var Player:Transform;

var spawn:Transform;
function OnTriggerEnter(col:Collider) {

if(col.tag =="Player"){
//your death script
Instantiate(Player,spawn.position,spawn.rotation):

} 

}

Read your comment
All this does is checks if something collides with it,It checks wether it has the tag Player or not
if it does then it respawns the player and if have a death code it kills the player

if you have no experience in scripting then how did you make the player to run,jump with anims

Note.This script is fixed and is in working condition

I’d just place a collider somewhere below all the boxes, and when the player collides with it, he gets transported back to the spawn point.

I think you can also simple check your character’s y position and if it is lower than your ‘you died’.y it will respawn:

var deathHeight : float = -5;

if(transform.position.y <= deathHeight){
	Respawn();
}

I am new too, haha so I’ll give it a shot :slight_smile:

If you place this script on your character you can probably use the following:

– this is in JavaScript and untested –

var deathHeight : float = -5; // The amount of meter's under your playing platform your character is allowed to be before it has to be respawned

function Update () 
{
  // If the character is below or at the deathHeight -> respawn;
  if(transform.position.y <= deathHeight){
    transform.position = Vector3(0, 0, 0);
  }
}

This should place your character back at 0,0,0 when the charact’s y position in the world has been -5 or lower than -5.
Please tell me if it worked :slight_smile: