Hey Danielman2 , here are two scripts that do the same thing, one in JS and one is C# as im not sure what you are working in but anyway…
INSTRUCTION:
1.Make a new cube object in scene
2.Attach this script to it in the inspector.
- Drag your object that the enemy should target (i assume your player gameObject and drop it into script in inspector).
- Be aware that I have placed a public slot for the actual transform you are moving, this is not necessary as you are already addressing it as script would be attached to it, but it atleast helps you understand the specific objects you are manipulating here. (change the public part to read “private” or just add the object to script in inspector, no harm will come from it)
- Press play.
WHAT SHOULD HAPPEN NOW?.. you should see the transform moving towards your player (if placed in sight of player view, it will then move towards you slowly…using your mouse, place the cursor over the object moving towards you and press and hold “left click” it should stop…release the mouse button and it should start moving)
I will return with a RayCast option too, but i liked that dumytruncs answer, because effectively he is right.
btw, move to C#, Coding canbe hard generally but C#`s not so hard to get your head around and in a few months time you can return to here and say thanks Gruffy, you were right about moving languages and that you love C# and cant think of touching Unity with that horrible loose language that has its place, but maybe not in Unity for much longer (i dont know that, im just saying)

Hope it all helps and if you can mark my answer if it does the job dude, that would be great
Gruffy
c# version
public class TranslateObjectToTargetAndMouseControl : MonoBehaviour
{
public Transform myTrans;
public Transform target;
public float speed = 1.0f;
// Use this for initialization
void Start ()
{
//cache you public gameobject/transform
myTrans = this.transform;
}
// Update is called once per frame
void Update ()
{
//interpolate from current position to the target over time
myTrans.position = Vector3.Lerp (myTrans.position, target.position, speed * Time.deltaTime);
}
void OnMouseDown()
{
speed = 0.0f;
}
}
javascript version
#pragma strict
public class TranslateObjectToTargetAndMouseControl extends MonoBehaviour
{
var myTrans : Transform;
var target : Transform; //put the object you want the transfrom to move towards (this would be you player most likely)
var speed : float = 1.0f; //the speed at which your object is moving towards player
function Start()
{
//cache you public gameobject/transform
myTrans = this.transform;
}
function Update ()
{
//interpolate from current position to the target over time
myTrans.position = Vector3.Lerp (myTrans.position, target.position, speed * Time.deltaTime);
}
function OnMouseDown()
{
//when left mouse button clicked it will stop speed
speed = 0.0f;
}
function OnMouseUp()
{
//when left mouse click is lifted, speed will return to 1.0 and start moving
speed = 1.0f;
}
}
PS…I JUST TESTED THIS AND IT WORKS PERFECTLY, just in case you feel it doesnt
Okay, well done for sorting out your own problem, that`s the way to do it dude ! As I have given you basically an entire script that will do exactly as you ask succinctly, could you please mark it as your answer as it may help others who come across this issue in the future who may either be using jS or C# (to accomplish what youve asked and had answered by myself etc) Cheers bud. Gruffy PS. I also take it you will not be need ing a raycast equivalent to show you that method of approach against this one :) Let me know :)
– Gruffyany more information on this?
– birdonblack