Cannot stop character movement upon trigger

I want to make it so when the player walks over this trigger it stops movement but still lets them move the camera

function OnTriggerEnter(other : Collider) {

GetComponent(“CharacterMotor”).enabled
= false;

}

Thats what i’ve got but it comes up with the error “Object reference not set to an instance of an object”

Any help would be much appreciated

has to be:

GetComponent(CharacterMotor).enabled = false;

without the “”

function OnTriggerEnter(other : Collider){
if(other.gameObject.CompareTag(“Player”)){
var charMotor : CharacterMotor ;
charMotor = other.GetComponent(CharacterMotor) ;
charMotor.enabled = false ;
}
}

…or just using [ other.GetComponent(CharacterMotor).enabled = false ;] would probably work also… what I think you’re missing though, is simply the ‘other.’ part since I’m assuming your script is on another object and you need to get the character motor script off of the object that enters it (what your code does at the moment, is try to get CharacterMotor from the object which this script is attached to, not the object that enters it)