Simple Script getting Errors.

Hello there :slight_smile: Iā€™m getting an error on the simplest of scripts that I cannot seem to fix :frowning:

Here is the script :

private var ray : Ray;
    private var rayCastHit : RaycastHit;
    
    function Update()
    {
        if(Input.GetMouseButton(0))
    	{
    	   ray = Camera.main.ScreenPointToRay (Input.mousePostion);
    		
    		if (Physics.Raycast (ray, rayCastHit))
    		{
    		    transform.position.x = rayCastHit.point.x;
    			
    		}
    		
    	}
    }

I am getting this error :

NullReferenceException: Object reference not set to an instance of an object
Paddle.Update () (at Assets/PongScripts/Paddle.js:8)

If anyone can tell me how to fix this that would be awesome ! :smiley:

mousePostion is misspelled. It should be mousePosition