Aim Down Sight Script not working with GUI Button, but working with MouseButtonDown(0)

I am making a fps game for windows phone. I have an Aim Down Sight script for my gun. It works fine with Input.GetMouseButton, but when I try and use the GUI function instead, it draws it but does nothing. Here is the original script:
#pragma strict

var Aim : boolean = false; var Cam : GameObject;


function Update () { if(Input.GetMouseButtonDown(0)){ Aim = true; if(Aim == true){ Cam.active = true; } }

if(Input.GetMouseButtonUp(0)){ Aim = true; if(Aim){ Cam.active = false; }
}
}

Here is the script with GUI Functions:

enter code here#pragma strict

var Aim : boolean = false; var Cam : GameObject;


function OnGUI () { if(GUI.Button (Rect (20,40,80,20), "ADS")){ 
Aim = true; if(Aim == true){ Cam.active = true; } }

if(GUI.Button (Rect (20,40,80,20), "ADS")){
 Aim = true; if(Aim){ Cam.active = false; }
}
}

I am much less confident with GUI input. I keep pressing it but it doesn’t ADS like the MouseButton(0). I’d much rather have this as a GUI functionality, as it plays weird on my phone as a tap.

Thanks.
BenDy Games, Game Development For Windows Phone 8

By convention, variables should start with a lower case letter. Functions and classes start with an upper case letter. Here is a bit of code that does with GUI what your original code was doing with OnMouseDown()/OnMouseUp():

#pragma strict
 
var aim : boolean = false; 
var cam : GameObject;

private var rect = Rect(20,40,80,20);
 
function OnGUI () { 

	var e = Event.current;

	if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) {
		aim = true;
		cam.SetActive(true);
		Debug.Log("Finger Down");
	}

	if (e.type == EventType.MouseUp && rect.Contains(e.mousePosition)) {
		aim = true;
		cam.SetActive(false);
		Debug.Log("Finger Up");
	}
	
		GUI.Button (Rect (20,40,80,20), "ADS");
}

Note I was a bit confused about ‘aim’ being set to ‘true’ for both the mouse down and the mouse up case. Are you sure that is what you want to do? Is there more to this script?