Make Arrow(Bullet) to follow the player

I want write a Tower script which can shoot arrow to people,tower dosent need to be rotation,just shoot the arrow to people.

but my arrow dosent follow my player,
could anyone help me :frowning:

thanks!


var LookAtTarget : Transform;  
var timeDelay = 5;  
var ArrowPoint : GameObject;  
var Arrow : GameObject;  
 
function Start() {  
 
    while (true) {  
 
        yield WaitForSeconds(timeDelay);
        //The function(The gameObject, THE SPAWNS LOCATION, the spawns direction)  
 
       var arrowClone : GameObject = Instantiate( Arrow, ArrowPoint.transform.position, Quaternion.identity );  
       arrowClone.transform.LookAt(LookAtTarget);
       arrowClone.rigidbody.AddForce(transform.forward * 1000);  
       Destroy ( arrowClone, 15 );
    }  
 
}  
 
function Update () {  
 
}

Instantiate your arrow into a variable :

var arrowClone : GameObject = Instantiate( Arrow, ArrowPoint.transform.position, Quaternion.identity );

Using that stored reference to the Instantiated arrow, now you can tell it to look at the target :

arrowClone.transform.LookAt(LookAtTarget);

now you have a reference to the instantiated arrow, you don’t have to find it :

Destroy ( arrowClone, 10 );

you could try a Vector3.Lerp(Target.x,Target.y,Target.z);