Stop running script when object is selected.

Hey! Iv'e got a problem, i can't seem to be able to stop running a script as i select the object, and then when i select a other object i want i the start running the script again. I am using raycast to select object, like this:

var objektnamn : String;

function Update ()
   if ( Input.GetMouseButtonDown(1) )
      var hit : RaycastHit;
      var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
      if (Physics.Raycast (ray, hit, 1000.0))
        objektnamn =;

   if ( objektnamn == )
     var speed = 9.0;
     var rotateSpeed = 9.0;
     var controller : CharacterController = GetComponent(CharacterController);
     transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
     var forward = transform.TransformDirection(Vector3.forward);
     var curSpeed = speed * Input.GetAxis ("Vertical");
     controller.SimpleMove(forward * curSpeed);

And i woud like to stop the Al.js script (Waypoint script) when a certain object i selected. Hope you understand, maybe i messed up? Apriciating answers A LOT! Thanks in advance! Sorry for poor english... //Tommy

I'm not quite sure what you're asking, but if you want to disable a script, set its enabled property to false. so like GetComponent(CharacterController).enabled = false;