object reference not set to an instance

I have seen this here a few times, but dispite all of the help I still cannot figure it out. Please help.

var Target : Transform;
var Distance : float = 14;
var CameraY : float = 12;

function Update () {
    transform.position.z = Target.position.z - Distance;
    transform.position.x = Target.position.x + 10; }

function LateUpdate () {
    GetComponent.<Camera>().main.transform.position.y = CameraY;

}

(This is the troubled line)

Probably Target is null. Make sure you’ve assigned it in the inspector.

In LateUpdate(), if you want to access the main camera tagged with MainCamera, it suffices to write Camera.main.transform.position.y. Otherwise, if the camera is attached to the same gameObject that this script is attached to, you should write GetComponent<Camera>().transform.position.y.

Drag and drop the gO you wish to use for “Target” into the target variable on your script, via the inspector.

As far as i know, you might be getting the error because of your variable assignment.
In unity, I think Target is a command (Not sure what for though) and Distance refers to vector3.Distance. Unity is probably reading this piece of script and getting confused because a command is being used in place of a variable. Eg, it is waiting for vector3.Distance, not just distance.

Technically, i don’t think there is anything wrong with your script. You just have to change your variable names to something unity doesn’t take as a command. In your circumstance, i would say the easiest way to do this is just have your variables as they are but not starting with capital letters. That should be enough to stop it from becoming confused.

Hope this helps