Need help with my ai please

Hi im having a problem i am making a script so that my ai follows me and it dossent seem to be moving and i have no idea why i cant see any mistakes i have added player and charecter controller into it via inspecter

i started off with this which works fine but has no physics and it flys

var Distance ;
var Target : Transform ;
var LookAtDistance = 25.0 ;
var AttackRange = 15.0 ;
var MoveSpeed = 5.0 ;
var Damping = 6.0 ;

function Update ()
{
	Distance = Vector3.Distance(Target.position, transform.position);
	
	if (Distance < LookAtDistance)
	{
		renderer.material.color = Color.yellow;
		LookAt();
	}
	if (Distance > LookAtDistance)
	{
		renderer.material.color = Color.green;
	}
	if (Distance < AttackRange)
	 {
	  	renderer.material.color = Color.red;
	  	Attack();
	 }
}
function LookAt ()
{
	var rotation = Quaternion.LookRotation(Target.position - transform.position);
	transform.rotation = Quaternion.Slerp (transform.rotation, rotation , Time.deltaTime * Damping);
}

function Attack ()
{
	transform.Translate(Vector3.forward * MoveSpeed * Time.deltaTime);
	
}

and then added more to make it use gravity and changed colider to a charecter controller

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 < 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.forward;
	moveDirection *= moveSpeed;
	
	moveDirection.y -= gravity * Time.deltaTime;
	controller.Move(moveDirection * Time.deltaTime);
}

function attack ()
{

}

if anyone sees any mistakes please reply

If you haven’t fixed this yourself already, I edited you script and made a few improvements

var Distance;
var Target : Transform;
var lookAtDistance = 25.0;
var chaseRange = 15.0;
var attackRange = 1.5;
var moveSpeed = 0.25;
var Damping = 6.0;
var gravity : float = 2000.0;
var controller : CharacterController;
 
function Update ()
{
    Distance = Vector3.Distance(Target.position, transform.position);
 	
	moveDirection = transform.forward;
	
	moveDirection.y -= gravity * Time.deltaTime;
	controller.Move(moveDirection * Time.deltaTime);
	
    if (Distance < lookAtDistance)
    {
       lookAt();
    }
 
    if (Distance > lookAtDistance)
    {
       renderer.material.color = Color.green;
    }
 
    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;
 
	transform.Translate(Vector3.forward * moveSpeed);

}
 
function attack ()
{
 
}

You need to have a rigidbody and character controller for it to work

the var controller needs to be set to the object that you want this script to affect

I put the gravity in the function Update section because otherwise the enemy floats in the air when you aren’t around

nothing is working can anyone help me?