On Collision send player to spawn

So I’m making a game where if you fall off the map the invisible cuboid below it will send you to spawn upon collision with it.

var player : GameObject;

function OnStart ()
{
	player = GameObject.Find("Player");
}

function OnCollisionEnter(theCollision : Collision){
  if(theCollision.gameObject.name == "Player")
  {
  	player.position = Vector3(0,4,0);
  }
}

Is what I have so far. How ever this does not do anything. The spawn coords are 0, 4, 0.

I don’t have much experience as well, but I would suggest you check the box in the cuboids collider that says IsTrigger. Now you can use that with a OnTriggerEnter method Docs on OnTriggerEnter . So with this you could develop something that works with your scripts.

It should be:

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

Hope you got it all to work!