Unity giving errors that do not exist!

I dunno how, but unity gives me Non-Existing errors! HELP!!!

Following are the errors:

  1. Unexpected token: }.
  2. expecting (, found 'HealthConfidenceNRG'
  3. ';' expected. Insert a semicolon at the end.
  4. expecting (, found 'AnimationController'.
  5. ';' expected. Insert a semicolon at the end.
  6. expecting }, found ''.

    Code:

    function OnTriggerEnter( other : Collider ) {
    if (other.tag == AreaChanger ) 
        { 
         if (score == ReqiredScore)
    	 {
           Time.timeScale = 0;
           AskToChangeScene = true;
    	}
    	else {
    	Time.timeScale = 0;
    	NotEnoughScore = true;
    	}
    	}
    }
    
    function OnGUI()
    {
    GUI.skin = newSkin;
    GUI.Button (new Rect (0,1,100,30), "Energy" + ":" + Energy.ToString());
    GUI.Button (new Rect (100,1,100,30), "Health" + ":" + Health.ToString());
    GUI.Button (new Rect (200,1,100,30), "Confidence" + ":" + Confidence.ToString());
    
    if (LostTheGame)
    {
    GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "You Lose");
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
    Application.LoadLevel(MenuSceneName);
    }
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Retry")){Application.LoadLevel(CurrentSceneName);}
    }
    if (AskToChangeScene)
    {
    GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "Enter Building?");
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Yes")){
    Application.LoadLevel(OtherSceneName);
    }
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "No"))
    }
    {
    Time.timeScale = 1;
    AskToChangeScene = false;
    }
    if (NotEnoughScore)
    {
    GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "You Did Not Find Enough Feathers");
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Okay."))
    {Time.timeScale = 1;
    NotEnoughScore = false;}
    }
    }		
    function HealthConfidenceNRG(){
    Energy -= EnergyLoss;
    
    if (Energy <= 1)
    {
    Time.timeScale = 0;
    Debug.Log("You Lost The Game!!!");
    LostTheGame = true;}
    
    if(Health <= 1)
    {
    Time.timeScale = 0;
    Debug.Log("You Lost The Game!!!");
    LostTheGame = true;}
    
    if(Confidence <= 1)
    {
    Time.timeScale = 0;
    Debug.Log("You Lost The Game!!!");
    LostTheGame = true;}
    }
    
    function AnimationController()
    {
    if (Input.GetKey(KeyCode.LeftArrow)||Input.GetKey(KeyCode.RightArrow ))
    {MyAnimatedModel.animation.Play(RunAnimation.name);}
    if (rigidbody.IsSleeping())
    {MyAnimatedModel.animation.Play(PlatformAnimation.name);}
    }
    

The first error is always real, but 1) the position of the error is often on the previous line, 2) the compiler is making a guess at the problem based on its state. The real problem may be different that indicated. Errors other than the first one may or may not be real. I’ve fixed a single error and had 20+ error message disappear. I’ve fixed the only error reported and had 20+ error messages appear. Again, only worry about the first error message.

The first error here is a missing ‘;’ at the end of line 46. Fixing that error will likely show more errors. Just fix the top error and return to Unity to find the next error to fix.

Using proper indentation will make this code much easier to read and maintain. Also including the pasted error(s) from the console is helpful in answering your questions about syntax errors.

function OnTriggerEnter( other : Collider ) {
if (other.tag == AreaChanger )
{
if (score == ReqiredScore)
{
Time.timeScale = 0;
AskToChangeScene = true;
}
else {
Time.timeScale = 0;
NotEnoughScore = true;
}
}
}

function OnGUI()
{
	GUI.skin = newSkin;
	GUI.Button (new Rect (0,1,100,30), "Energy" + ":" + Energy.ToString());
	GUI.Button (new Rect (100,1,100,30), "Health" + ":" + Health.ToString());
	GUI.Button (new Rect (200,1,100,30), "Confidence" + ":" + Confidence.ToString());
	 
	if (LostTheGame)
	{
		GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "You Lose");
		if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu"))
		{
			Application.LoadLevel(MenuSceneName);
		}
	
		if (GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Retry"))
		{
			Application.LoadLevel(CurrentSceneName);
		}

	}

	if (AskToChangeScene)
	{
		GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "Enter Building?");
		if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Yes"))
		{
			Application.LoadLevel(OtherSceneName);
		}

		if (GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "No"))
		{
		}
		
		Time.timeScale = 1;
		AskToChangeScene = false;
	}

	if (NotEnoughScore)
	{
		GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "You Did Not Find Enough Feathers");
		if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Okay."))
		{
			Time.timeScale = 1;
			NotEnoughScore = false;
		}
	}
} 
    
function HealthConfidenceNRG(){
	Energy -= EnergyLoss;
	 
	if (Energy <= 1)
	{
		Time.timeScale = 0;
		Debug.Log("You Lost The Game!!!");
		LostTheGame = true;
	}
	 
	if(Health <= 1)
	{
		Time.timeScale = 0;
		Debug.Log("You Lost The Game!!!");
		LostTheGame = true;
	}
	 
	if(Confidence <= 1)
	{
		Time.timeScale = 0;
		Debug.Log("You Lost The Game!!!");
		LostTheGame = true;
	}
}
 
function AnimationController()
{
	if (Input.GetKey(KeyCode.LeftArrow)||Input.GetKey(KeyCode.RightArrow ))
	{
		MyAnimatedModel.animation.Play(RunAnimation.name);
	}
	if (rigidbody.IsSleeping())
	{
		MyAnimatedModel.animation.Play(PlatformAnimation.name);
	}
}