Toggle Movement Help

I'm a little brain dead and should've been able to figure this out by now. So any help would be wonderful about now....

I'm trying to figure out the best way to script out a toggle using an input key like "m." Whenever the user presses the "m" on the keyboard, the motion of the gameobjects should start and then reset once pressed again.

I think could have it all in one code, but also know that I may to change it from an input key to use a GUI button. With that, I'd kinda like to have it in another script by itself. The code below is on the spheres....


var move : boolean;
var speedOne : float;
var speedTwo : float;
var speedThree : float;
var defaultRotation : Quaternion;

var switchTo = Transform;

function Start(){

    speedOne = Random.Range(50,200);
    speedTwo = Random.Range(50,200);
    speedThree = Random.Range(50,200);

    //Save Original/Default Rotation
    defaultRotation = transform.rotation;
}

function Update (){
    if(move==true){
        transform.Rotate(Vector3.right, speedOne*Time.deltaTime);
        transform.Rotate(Vector3.up, speedTwo*Time.deltaTime);
        transform.Rotate(Vector3.forward, speedThree*Time.deltaTime);
}
    else{
    transform.rotation = Quaternion.Slerp(transform.rotation, defaultRotation, Time.deltaTime);
    }
    move = GameObject.Find("Trigger").GetComponent.(Trigger),move;
}

This would be a good case for a static variable, where the "move" variable wouldn't be in that script at all, but in a separate manager script. You could have a script called Manager.js, attached to an empty game object:

static var move = false;

function Update () {
    if (Input.GetButtonDown("Move"))
        move = !move;
}

Then your other script would check "Manager.move" instead of "move", and you would set up the "Move" button in the input manager. You can also have a GUI button function on the manager script that toggles "move" as well.