Help with my code?(NullReferenceException)[CLOSED]

I keep getting this error with my code.

NullReferenceException: Object reference not set to an instance of an object
Gui.OnGUI () (at Assets/Essential Scripts/Gui.js:15)

It is on this line:

if(script.selected1 == true)

Here is my code:

	var rType = 0;
	var script : Selecting_System;
	function OnGUI() {

		

		if (GUI.Button(Rect(10,70,50,30),"Click")){
			rType = 1;
			Debug.Log("Clicked the button with text");
	}
				if(rType == 1)
				{
					if(script.selected1 == true)
					{
						Debug.Log("Success");
					}
				}else{
				Debug.Log("Else");
				}

}

I’m trying to get it so that when I click the gui button the variable “rType” is equal to 1. Then I want it so when the variable from another script(selected1) is true and the variable “rType” is equal to 1 it will debug “success” It keeps giving me the error i typed above. If you could critique my script and/or explain why I am getting this error that would be great. Thanks in advanced.

In the line you posted, NullReferenceException can be caused only by null script variable. So most probably you didn’t set this variable in the inspector. Or, less likely, you set it to null somewhere else in your code.

First Check your spelling sounds stupid i know but that is my worst problem

second what are you doing with
var script : selecting_system
shouldn’t that be

var script = selecting_system

and i believe you are missing a closing Bracket }

but i may very well be wrong with every thing is just said new to unity but know javascript