Shoot only once when clicked

im trying to get a single projectile to be fired every time i click the mouse button. but at the moment i am only getting a continous flow of projectiles. any ideas?

`
var projectile : Rigidbody;
var speed = 1;

function Update ()
{

if(Input.GetButton(“Fire1”));
{
clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));

    Destroy (clone.gameObject, 3);

}

}
`

1 Answer

1

Try using Input.GetMouseButtonDown(0) instead of Input.GetButton(“Fire1”).

I hope that helps a bit.

thanks so much that helped a lot