Bullet doesn't destroy itself after a selected time

So I was working on a bullet script, I got the bullet to instatiate, it moves forward. My only problem is that after a certain amount of time it’s supposed to destroy itself. Instead of ddoing that, it will just travel for 2 seconds and then stop. It just sits there.

    var projectile : Rigidbody;
var speed = 20;

function Update () {
    // Put this in your update function
    if (Input.GetKeyDown("q")) {
		ShootBullet();
    }
}


function ShootBullet(){
	var projectileclone = Instantiate( projectile, transform.position, transform.rotation );
		projectileclone.velocity = transform.TransformDirection( Vector3( 0, 0, speed) );
		
		Destroy (projectileclone, 2);

}

What’s wrong with it?

You’re actually destroying the Rigidbody, not the projectile - projectileclone has the same type as the prefab reference, which’s a rigidbody in this case. Change the Destroy instruction to:

  Destroy(projectileclone.gameObject, 2);