Enabling the right script HELP!!!

Hey Guys i have a problem that i cant solve, in my game i have decided to let the player switch between characters. I have done this perfectly and both players show up when i press the right key but the problem is when the original player returns his walk script will not enable itself. when you start the game you will have the main player if you press forward he will walk and etc. As soon as i press N it changes the player and and disables the first players move script and when i press the M key the first player will show up and the second one will go but now the first players script wont enable why is that. Here is the code that i have placed on each character:



   //drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board

 var spawn : Transform;   

 //This will activate the new player 

 var NewPlayerPrefab : Transform;

 // the following 3 lines just deactivate the meshes on the player 
 var MainPlayer: GameObject;

  var MainHair : GameObject;

 var MainBody: GameObject;

 var MainPlayer: GameObject;

function Update()


    // Re-spawning the new player on the current players position 


    //This is deactivating the move script 

            GetComponent(NewMoveScript).enabled = false;

             MainPlayer.active = false; 

             MainHair.active = false;   // These 3 lines deactivate the players mesh 

             MainBody.active = false;

} }

this script is placed on the first player as soon as i click the 2nd player shows and the following script is attached to player 2:


  //drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board

    var spawnPlayer1 : Transform; 

   //This Variable will hold the  first player that we start of with 

    var NormalPlayer : Transform;

    //This line of code will activate the mesh for the first player 
    var MainPlayer1 : GameObject;

     //This line of code will deactivate the 2nd player

    var player2 : GameObject; 

     //This line of code will activate the Hair for the first player 
    var MainHairTrue: GameObject;

   function Update()



// If the M key is pressed the 2nd Player will no longer be viewable


//This line makes my first player re spawn on the second player last know position   


      //This line of code is activating my first players mesh 


            //this is activating my first players hair 


            // This line of code is activating the move script on the main player 

            GetComponent("NewMoveScript").active = true;



Now the problem i think occurs in this script the first script turns of the move script perfectly but when this line of code is activated :

 GetComponent("NewBehaviourScript").active = true;

the following message shows up:

   NullReferenceException: Object reference not set to an instance of an object

Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value) ResPlaye1.Update () (at Assets/ResPlaye1.js:23)

can you figure this out please thank you very much in regard :)

The error is telling you that the object this script is attached to has no NewBehaviourScript component, and yet you are trying to access it.

That's kind of a terrible name for a script, by the way. xD