How to make the 3rd person controller an enemy to my fps?

what should i do to make the 3rd person controller follow my fps?
I have this code attatched to my 3rd person controller but it just run away and disappear and it doesn’t follow my fps

var MoveSpeed : float = 2;
var Player : Transform;
var MinDist = 10;
 
 
function Update () 
{
    transform.LookAt(Player);
 
   if(Vector3.Distance(transform.position,Player.position) >= MinDist){
   		this.animation.Play("idle");
         //transform.position += transform.forward*MoveSpeed*Time.deltaTime;
    }
    else if(Vector3.Distance(transform.position,Player.position) <= MinDist){
   		this.animation.Play("walk");
        transform.position += transform.forward*MoveSpeed*Time.deltaTime;
    }
}

Hi,Use this to make him follow you

var MoveSpeed : float = 2;
var Player : Transform;
var MinDist = 10;
private var tmpmovespeed:float;
public var leasmindistance:float = 2;
function Start(){
tmpmovespeed = MoveSpeed;
}
function Update(){
 transform.LookAt(Player);//you can also use transform.rotation = Quaternion.Slerp....... it just as same only thing is it will be a bit more smooth
var direction = Player.position - transform.position;
if(Vector3.Distance(transform.position,Player.position) >= MinDist){
this.animation.Play("idle");

}
else if(Vector3.Distance(transform.position,Player.position) <= MinDist){
MoveSpeed = tmpmovespeed; 
this.animation.Play("walk");
transform.position = Vector3.Lerp(transform.position,Player.position,Time.deltaTime * MoveSpeed);

}
if(Vector3.Distance(transform.position,Player.position) <= leasmindistance){
MoveSpeed =0;
}
}

Note The above script is an alternative script

Hi check if your transform’s local axis is different from global axis if yes then use this script

function Update()
{
transform.LookAt(Player);
//ommitted other

 else if(Vector3.Distance(transform.position,Player.position) <= MinDist){
var dire:Vector3 = transform.TransformDirection(0,0,1);
this.animation.Play("walk");
transform.position += dire*MoveSpeed*Time.deltaTime;
}
}