Character controller Nullreference

Hi , I keep getting this weird error.

“NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)”

I already attached the character controller to the script that sits on my gameObject, and the target player is attached as well. I’ve double checked my script but I’m not sure whats wrong.

NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
AdvancedAi.chase () (at Assets/AdvancedAi.js:143)
AdvancedAi.Update () (at Assets/AdvancedAi.js:123)

var Distance;
var Target : Transform;  
var lookAtDistance = 25.0;
var chaseRange = 15.0;
var attackRange = 1.5;
var moveSpeed = 5.0;
var Damping = 6.0;
var controller : CharacterController;
var gravity : float = 20.0;
private var MoveDirection : Vector3 = Vector3.zero; 					
									
function Update ()					
{								
	Distance = Vector3.Distance(Target.position, transform.position); 
	
	if (Distance < lookAtDistance) 
	{
		lookAt();
	}
	if (Distance > lookAtDistance) 
	{
		renderer.material.color = Color.green;
	}
	if (Distance < attackRange)
	{
		attack();
	}
	else if (Distance < chaseRange) 
	{	
		chase ();
	}
}

		
function lookAt ()  
{		
    renderer.material.color = Color.yellow;
		 		 																		
	var rotation = Quaternion.LookRotation(Target.position - transform.position);
	transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);
																				
}										 

function chase () 
{	
	renderer.material.color = Color.red;						

	moveDirection = transform.foward; 
	moveDirection *= moveSpeed; 
	
	moveDirection.y -= gravity * Time.deltaTime;  
	controller.Move(moveDirection * Time.deltaTime); 
}	

function attack ()
{
	
}

You misspelled forward, you spelled it “foward”

That was your original problem.

This is why stronger typed/ more structured languages like C# are better. They catch things like this.