Need help with a script please!

Hello, so i am trying to code a simple pause menu and am getting errors…please help! It is JavaScript btw.

#pragma strict

var paused : boolean;
var areaSizeX : float;
var areaSazeY : float;
var spacing : float;

function Start (){

	paused = false;

}

function Update (){

	if(Input.GetKeyDown("escape")){
	
		if(paused = false){
	
			paused = true;
		
		}else
		
			paused = false;
		
		

	if(paused) {
	
		Time.timeScale = 0;
		
	}else
	
		Time.timeScale = 1;




	GUILayout.BeginArea(Rect (Screen.width/2, Screen.height/2, areaSazeY, areaSizeX));
	
	if(GUILayout.Button("Play")){
	
		Application.LoadLevel("Level 1");

	}
	
	GUILayout.Space(spacing);
		
	if(GUILayout.Button("High Scores")){
		
	}
		
	GUILayout.Space(spacing);
		
	if(GUILayout.Button("Quit Game")){
		
		Application.Quit();
			
	}
		
	GUILayout.EndArea();
}

Put gui into the void OnGUI() method

Or sorry its javascript so function OnGUI()

Sorry should have been more specific… i am getting the errors on lines 18 and 20

On line 18 you are trying to set the variable instead of getting it’s value.

if(paused = false)

should be:

if(paused == false)

or simply:

if(!paused)

Thanks…got that fixed but now my gui isnt working :confused:

#pragma strict

var paused : boolean;
var areaSizeX : float;
var areaSazeY : float;
var spacing : float;

function Start (){

	paused = false;

}

function Update (){

	if(Input.GetKeyDown("escape")){
	
		if(paused == false){
	
			paused = true;
		
		}else
		
			paused = false;
		
		

	if(paused) {
	
		Time.timeScale = 0;
		
	}else
	
		Time.timeScale = 1;
}

	function OnGUI (){

	GUILayout.BeginArea(Rect (Screen.width/2, Screen.height/2, areaSazeY, areaSizeX));
	
	if(GUILayout.Button("Play")){
	
		Application.LoadLevel("Level 1");

	}
	
	GUILayout.Space(spacing);
		
	if(GUILayout.Button("High Scores")){
		
	}
		
	GUILayout.Space(spacing);
		
	if(GUILayout.Button("Quit Game")){
		
		Application.Quit();
			
	}
		
	GUILayout.EndArea();
}

Getting errors on lines 37 and 39

It does not appear that you have given the variables ‘areaSizeX’, ‘areaSazeY’, and ‘spacing’ a value.

But first you need to fix your update function.
The if statement on line 16 is not getting closed properly. it’s missing a }

Fixed it thanks!!