Fixing this Null Reference Exception?

I’m trying to write a bit of code that send coordinates of one object to another script, but I’m getting a NullReferenceException.

The first script, Movement Point, has this:

var move : MovementScript = GetComponent(MovementScript); //x and y are established as the coordinates move.getMovementPosition(x, z);

The second script, MovementScript, has this:

function getMovementPosition(x : float, z : float) { //moves the player }

Both scripts have been attached to appropriate objects. Could anyone please offer a possible explanation for what is going wrong here?

You can search for an object of that type and, if found, call methods on it.

var move : MovementScript = FindObjectOfType(MovementScript);

If you have more than one MovementScript object in your scene, you can use:

var movers : MovementScript[] = FindObjectsOfType(MovementScript);