Need some help.beginner

Hello the thing i want to my script to do is to teleport my player to one location if he falls from a map.Now i dont get any errors.But the script doesnt work i dont know what commands to use.So if someone could help me ?
Please dont make fun of me if this script should do something else than teleport.

function Update () {
}

  var gameOver = false;
  var FirstPersonController;
  
  if ( gameOver == true )
   {
   print ("You are Dead");
   }
   
   if ( FirstPersonController.y-1) 
   {

var transform; y=5;x=5;z=5;


}

Im no expert but first of all I dont see anything that makes gameover ever turn true, and when your FP Controller.y-1 is called, all its doing is setting a variable…that does nothing

Yeah the problem is that i dont know what commands to use to move it to y5x5z5?

With that script do you ever see “You Are Dead” printed out? If not then your gameOver variable is never being set to true. To do this you need to make sure that the variable is set to true whenever your player falls off the map. I believe the 3d platform tutorial can help you with that:

First off, do you intend the “FirstPersonController” to be a class or a variable?

If the former, you completely botched the declaration. You would need to do something like:

var controller : FirstPersonController;

and then initialize it somewhere (or assign something to it via the editor)

If the latter, then you might need to give it a datatype since it is not a primitive. i.e.:

var FirstPersonController : GameObject; //GameObject can be whatever datatype you intended it to be

Again, make sure it is initialized in some manner.

Next, your curly braces are all messed up.

Your Update() function contains nothing due to the fact that you close the function immediately after opening it.
With this said, everything else is outside of any function. This means that it will never be called. I am honestly surprised it even compiles.

There’s alot wrong with that code snippet man. I think you just need to read up on some general programming before you get into Unity. And like someone else said…this wont even compile because of the brackets. You obviously haven’t even attached it to anything yet. :shock:

 var transform; y=5;x=5;z=5;

What you did here is simply set some random variables called “x, y and z” to five. O_o

 if ( FirstPersonController.y-1)

This will always be true as long as it’s not zero. So you will never reach inside the scope of the loop unless “y” is 1 when you start the game.

Ok thanks for the help.I still have lua in my head so its kinda hard for me to learn it when i mix both of them.