enemy AI (Zombehs)(SOLVED)

Hello to the forums. I am working on a 3rd person shooter called “Zombehs”.
webplayer demo here:http://www.creativecodingstudios.com/Unity/98.14.65.174/web.html

This game will feature many different maps and so far i have the shooting and movement down. i am trying to code an AI script that starts when Vector3.distance < 20
or something. when the vector3 distance is less less than 20 then the zombie object would follow the player. and then when the distance is < or equal to 3 than it would start attacking, but my main worry now is getting the zombies to follow me. Can anyone help?

Grab the FPS tutorial Completed version the AI script in there functions pretty close to what you’re looking for.

Check out the main AI script. Then check the secondary scripts on the Robot Enemies.

it found it out. heres my code:(INCOMPLETE)

var aggroDistance = 50;
var bulletPrefab : Transform;
var health = 10;
var player : GameObject;
var dir : Vector3;
var speed : float; 
//health bars
var healthfull : Texture2D;
var health9 : Texture2D;
var health8 : Texture2D;
var health7 : Texture2D;
var health6 : Texture2D;
var health5 : Texture2D;
var health4 : Texture2D;
var health3 : Texture2D;
var health2 : Texture2D;
var health1 : Texture2D;
var health0 : Texture2D;
var dead = false;
private var aggro = false;
function Update () {
//checks if the enemy is aggro
CheckAggro();
//health bar instantiation

//check if dead and stop script
if (health <= 0){
dead = true;
}
}
//checks if the bullet hit our zombie
function OnCollisionEnter(collision : Collision) {
if (collision.rigidbody) {
health--;
aggro = true;
}
}
function CheckAggro(){
	var dist = Vector3.Distance(GameObject.Find("EnemyAttack").transform.position, 
	transform.position);
	if (dist < aggroDistance){
		aggro = true;
	}
	   if(aggro){
   dir = player.transform.position - transform.position;
   dir = dir.normalized;
   transform.Translate(dir * speed, Space.World);
   }   
   else  {
      transform.eulerAngles.y = Mathf.PingPong(Time.time*20,90) -45;
      }
}
  
	//what the enemy will do if it is aggro
	if(aggro == true){
	print ("aggro on");
	}

Looking pretty good so far. I would love to see the finished script. I’m working on something similar so I’d love to see how they compare.