I’m thinking it’s stopping because it’s creating an object named “Player” at some location and then the object is only following that reference to “Player”. You also have that in Update() when means it’s creating a GameObject named “Player” every frame.
Try something like this instead (untested):
var targ : GameObject;
function Start(){
targ = GameObject.Find("Player");
}
function Update(){
transform.position = Vector3.MoveTowards(transform.position, targ.transform.position, .03);
}
Is your “targ” object the right object you want to follow?
Try something like: (Not tested, so fix any typos i might make!)
public var targ : Transform;
function Update()
{
transform.position = Vector3.MoveTowards(transform.position, targ.transform.position, .03);
}
so you don’t needlessly repeatedly find the same object. Anyway, with this you have to drag and drop your player object onto the inspector to link it up but it’ll work.