" ';' expected. Insert a semicolon at the end." Error Help

Hi. I am making an iOS game, and for some reason, Unity3d is saying I need a semicolon when there is actually one there. Here is the code:

//Script to revert winning player back to main menu
 
var levelToLoad : String;
 
function OnTriggerEnter(hit : Collider)
{
  if  (other.gameObject.name == "Player")
  then Application.LoadLevel(levelToLoad);
}
//END FUNCTION ONTRIGGERENTER

It says I need a semicolon on lines 8,7. Please help!

You don’t use ‘then’ in Javascript, so you need to remove it on line 8. You’ve not declared ‘other’. Usually that is the name of the collider passed in. Also a collider inherits the ‘name’ variable, so you don’t have to redirect through ‘gameObject’. Putting the changes together:

var levelToLoad : String;

function OnTriggerEnter(other : Collider)
{
    if  (other.name == "Player")
        Application.LoadLevel(levelToLoad);
}