Trying to get AI to follow who ever is closer

so im trying to get my enemy AI, to follow who ever is closer but all he does is just sit there…

SCRIPT:

#JAVASCRIPT

var target : Transform;
var target1 : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var range : float=10f;
var range2 : float=10f;
var stop : float=0;
var myTransform : Transform;

function Awake()
{
myTransform = transform;
}

function Start()
{
target = GameObject.FindWithTag(“Player”).transform;
target1 = GameObject.FindWithTag(“Player”).transform;
}

function Update ()
{

 var distance = Vector3.Distance(myTransform.position, target.position);
 var distance1 = Vector3.Distance(myTransform.position, target1.position);
 
 if(distance > distance1)
 {     
 	if (distance<=range2 &&  distance>=range)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}

 	else if(distance<=range && distance>stop)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 	}
 	else if (distance<=stop) 
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}
 
}

	if(distance1 > distance)
 {     
 	if (distance1<=range2 &&  distance1>=range)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}

 	else if(distance1<=range && distance1>stop)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 	}
 	else if (distance<=stop) 
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}
 
}

}

if any one can please help me it would be very helpful

You only seem to be changing the rotation of the object, if you actually want it to follow the other object then you need to be changing the position.

Note: when changing the position you can use Vector3.Slerp just like you are currently using Quaternion.Slerp for the rotation

#pragma strict

var target : Transform;
var target1 : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var range : float=10f;
var range2 : float=10f;
var stop : float=0;
var myTransform : Transform;

function Awake()
{
myTransform = transform;
}

function Start()
{
target = GameObject.FindWithTag(“Player1”).transform;
target1 = GameObject.FindWithTag(“Player2”).transform;
}

function Update ()
{

 var distance = Vector3.Distance(myTransform.position, target.position);
 var distance1 = Vector3.Distance(myTransform.position, target1.position);
 
 if(distance > distance1)
  {     
 	if (distance<=range2 &&  distance>=range)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}

 	else if(distance<=range && distance>stop)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 	}
 	else if (distance<=stop) 
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}
 
}

if(distance1 > distance)
 {     
 	if (distance1<=range2 &&  distance1>=range)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}

 	else if(distance1<=range && distance1>stop)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 	}
 	else if (distance<=stop) 
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}
 
}

if(distance==distance1)
 {
 	if (distance1<=range2 &&  distance1>=range)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}

 	else if(distance1<=range && distance1>stop)
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 		myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 	}
 	else if (distance<=stop) 
 	{
 		myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 		Quaternion.LookRotation(target1.position - myTransform.position), rotationSpeed*Time.deltaTime);
 	}
 		  	 
 }

}

this is my script now but same problem, the enemy does not move