A couple thousand errors

Ive been trying to get a recoil and a gun shooting script to link up when I press the mouse key. The game can run, but I get about a million of these:

Ive googled the problem and haven’t been able to find any solution, here is the script:

var projectile: Rigidbody;
var speed = 10; 

function Update()
clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));

Destroy(clone.gameObject, .25);

Any help would be appriciated.

You have code referencing an object (clone) that’s active every frame from Update(), because only the clone = Instantiate line is within the if(…) scope. So every frame it calls clone.velocity & Destroy, even tho clone no longer exists.