Toggle Enabled/Disabled script?

I'm trying to enable and disable a script with the OnGui: Target variable. So far ive gotten:

> var toggleBool = true;
    function OnGUI() {    
    var toggleBoolNew = GUI.Toggl (Rect (25, 25, 100, 30), toggleBool,"Toggle");      
    // Check if the toggle was toggled    
    if (toggleBoolNew != toggleBool) {        
    if (toggleBoolNew== true)            
    Debug.Log("Toggle was enabled"); 
> Debug.Log("Toggle was disabled");     
> toggleBool = toggleBoolNew;    

how do i modify this to make if enable/disable a script when the toggle is on/off?

You can use

go.GetComponent("your script name").enabled = false;// for disabling 
go.GetComponent("your script name").enabled = true;// for enabling

you can use this on any Component.

bool toggleOn = false;

 void Update()
 if (Input.GetKeyDown(KeyCode.Space))
           toggleOn = !toggleOn

 if (toggleOn)
 //Do something when toggle is on

 if (!toggleOn)
 //Do something when toggle is off