Bow and Arrow Animation and script

So i have my Archer, Bow and arrow all good including the animation and i started making the script for the arrow shooting but what i cant figure out is how to make it so the arrow wont shoot until the animation is at the point of shooting and not shoot then play animation.

Here is my script:

var ArrowSpawn : Transform;
var Arrow : GameObject;
var Ammo = 1;
var Shoot = true;


function Update () {
if (Ammo == 0) {
Shoot = false;
Reload();
Ammo = 1;
}
}
if(Shoot == true){
if(Input.GetButtonDown("Fire1")){
yield WaitForSeconds (1.05);
Instantiate(Arrow, ArrowSpawn.transform.postion, ArrowSpawn.transformation.rotation);
Ammo--;
}
}


function Reload () {
yield WaitForSeconds (2);
Shoot = true;
}

H=====================================================================H

var ArrowSpawn : Transform;

var Arrow : Rigidbody;

var ammo = 1;

var Speed = 20;

var Shoot = true;

var AnimTime : float; // Time till the animation comes to releasing the arrow or the total time of the animation

function Update(){

if(Input.GetKey(“Fire1”) && ammo > 0){

timer+=Time.deltaTime;

if(timer >= AnimTime)

{

var Arrow = Instantiate(Arrow, ArrowSpawn.position, ArrowSpawn.rotation);

Arrow.rigidbody.velocity =transform.TransformDirection(Vector3(0,0,Speed));

timer = 0.0;

ammo–;

}

}

}

H=====================================================================H

hope this helps :slight_smile: