Cloning help?

Hello, I’ve been making a small game with Kunai’s, Katana’s and such and i know the basics of scripting.
The Kunai is an throw-able weapon and i wanted it to be cloned, thrown and then destroyed with this script which seemed to work

var projectile : Rigidbody;
var speed = 20;
var lifetime = 1;
 
function Update () {

    if (Input.GetMouseButton(0)) {

    var clone : Rigidbody;
    clone = Instantiate(projectile, transform.position, transform.rotation);
    

    clone.velocity = transform.TransformDirection (Vector3.forward * speed);
    

    Destroy(clone.gameObject, lifetime);
    }
}

but the script clones several copies after one click, not just one at a time as i wish.

8709-193a819c1ef189fca6e3c67dcb2f5af8.png

Can anyone please help me with this?

Thanks

You want to use Input.GetMouseButtonDown(0) instead of Input.GetMouse(). Input.GetMouse button will return true for any frames in which the mouse is held down. Input.GetMouseButtonDown(0) only return true for the frame in which the mouse is pressed.