Scripting help?

Hey all,

I am currently writing an “OnTriggerEnter” script that will ONLY function when the player enters the trigger zone. I am trying to make it so when the player (First Person Controller) enters a trigger zone, it will teleport me to a new scene. The only restriction is the player can be the ONLY thing that sets off the trigger. Here is the script so far:

function OnTriggerStay(hit:Collider){

    if(hit.gameObject.tag == "Player"){
 
       Application.LoadLevel (2);
    }
}

Can anybody tell me why this isn’t working? Thanks for your help, guys!

Make sure you tagged your FPS controller to “Player”.
If that doesn’t solve your problem, make sure you have loaded in your scene so when you jump Application it in fact does exist.

try OnTriggerEnter() :

function OnTriggerEnter(hit:Collider){

   if(hit.gameObject.tag == "Player"){   
      Application.LoadLevel (2);
   }
}