I need help Enabling/Disabling Script (JavaScript)

I need to disable/enable the default First Person Controller on my character.
52677-capture.png
This is my script so far:

#pragma strict

public var TabState : int = 1;
 
function Update ()
{
    if(Input.GetKeyDown (KeyCode.Tab))
    {
          switch (TabState)
          {
               case 1:
                      //Enable
                      TabState = 2;
                      break;
               case 2:
                      //Disable
                      TabState = 1;
                      break;
         }
    }
}

Any Help would be apreciated!

First, you must have a reference to the script you wish to enable/disable. You can make this a public variable and drag the gameobject using the script into the inspector:

public var scriptName : ScriptName;

This method is good to use if you know exactly what gameobject is using the script or if it’s already in the scene. You then enable/disable the script like so:

scriptName.enabled = true;
scriptName.enabled = false;

Or you can grab the component from the gameobject using it:

public var scriptName 		   : ScriptName;
public var gameobjectUsingScript : GameObject;

scriptName = gameobjectUsingScript.GetComponent( ScriptName );

then enable/disable the script like so:

scriptName.enabled = true;
scriptName.enabled = false;