Raycasting null object reference error

I’m fairly new to scripting in Unity, and I’m creating a game where I want to change cameras when an object is clicked on. I’m not focusing on the code for changing cameras at the moment, but instead detecting if the object has been clicked on. I’ve looked around and modified some code from other places to use Raycasting. Here is my code:

function FixedUpdate () {
	var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	var Hit : RaycastHit;
	if(Physics.Raycast(ray, Hit, 1000)){
		if(Hit.collider == null){
			Debug.Log("miss");
		}
		else if(Hit.collider.tag == "document") {
			Debug.Log("clicked");
		}
	}
}

I keep getting NullReferenceException: Object reference not set to an instance of an object.

I have the script attached to the first person camera in the scene.
Please Help!

The problem is you are checking if the hit collider is null, which is not what you want. The if(physics.Raycast) part checks if it hits something, so you are checking something that will never happen. Here is how I would do it.
Two notes: First, do not call it in the FixedUpdate. Second, your naming is inconsistant, a raycasthit named Hit, with capital, but a ray without capital?

Here is how it should look:

function Update () {
    var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    var hit : RaycastHit;
    if(Physics.Raycast(ray, Hit, 1000)){
       if(Hit.collider.tag == "document"){
         Debug.Log("hit");
       }
       else {
Debug.Log("You hit something else.");
}
    }
else{
Debug.Log("miss");
}

}