Button Press Help?

Hi guys i created this script all it dose is it disables and enables a script. But the problem is if i press the button the script will go off as should but if i want to turn it on again i have to press the same key again now that works fine as well. Now the problem is the timing if i press the key i have to wait 2 or 3 seconds before i can press it again to enable or disable the script. Is there a way where i press the key right away after i pressed it with out the timing issue oh and yes i have to some time hold the key to enable the script and disable it. Here is the script:

  var OnScript : boolean = true; 

  function Update()
  {

   if(Input.GetKey(KeyCode.K) && OnScript ){

   OnScript = false; 
  GetComponent(AnimationScript).enabled = false;

   }
  else if (Input.GetKey(KeyCode.K) && OnScript == false ){

   OnScript = true;
   GetComponent(AnimationScript).enabled = true;

   }
   }

thank you in advance :)

You could use `Input.GetKeyUp()` instead. That would return true only when the user releases the key, versus `Input.GetKey()`, which returns true while the user is holding the key.

 var OnScript : boolean = true; 

 function Update() {
      if(Input.GetKeyUp(KeyCode.K) && OnScript) {
           OnScript = false; 
           GetComponent(AnimationScript).enabled = false;
      }
      else if (Input.GetKeyUp(KeyCode.K) && !OnScript) {
           OnScript = true;
           GetComponent(AnimationScript).enabled = true;
      }
 }

(I made a few modifications to your code for easier reading and better format)