BCE0044: expecting (, found 'OnGUI'.

I get the error message “Assets/Scripts/RespawnMenu.js(28,10): BCE0044: expecting (, found ‘OnGUI’.”

this is my Script


#pragma strict

var LookAround01 : MouseLook;
var LookAround02 : MouseLook;
var charMotor : CharacterMotor;
var sprintScript : SprintAndCrouch;

static var PlayerIsDead = false;

function Start () 
{
	LookAround01 = gameObject.GetComponent(MouseLook);
	LookAround02 = GameObject.Find("MainCamera").GetComponent(MouseLook);
	charMotor = gameObject.GetComponent(CharacterMotor);
	sprintScript = gameObject.GetComponent(SprintAndCrouch);
}

function Update ()
{
	if (PlayerIsDead == true)
	{
		LookAround01.enabled = false;
		LookAround02.enabled = false;
		sprintScript.enabled = false;
		charMotor.enabled = false;
}

function OnGUI()
{
	if (PlayerIsDead == true)
	{
		if (GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40),"Respawn"));
		{
			RespawnPlayer();
		}
		if (GUI.Button(Rect(Screen.width*0.5-50, 240, 100, 40),"Main Menu"));
		{
			Debug.Log("Return to Main Menu");
		}
	}
}

function RespawnPlayer()
	{
	Debug.Log("Respawn Player");
}	}

I also get these errors

Assets/Scripts/RespawnMenu.js(28,17): UCE0001: ‘;’ expected. Insert a semicolon at the end.

Assets/Scripts/RespawnMenu.js(43,10): BCE0044: expecting (, found ‘RespawnPlayer’.

Assets/Scripts/RespawnMenu.js(43,25): UCE0001: ‘;’ expected. Insert a semicolon at the end.

Well the semi-colon is definitely wrong.

Without seeing your entire code file so I know what you were trying to do I cant help more then that.

In general you should always post the entire file you are having trouble with (properly formatted) and the complete error message as Unity printed it if you want help.

You are short a } on line 26

if(condition) type statements don’t use ; a the end