How to let the bullets dissapear

Hi there!

Is it possible that when you shoot a bullet it will dissapear after a given distance?

Because, everytime i shoot a bullet it will clone the bullet i shot, i can see the that the bullets are travelling and travelling and never stops. That gives alot of lag after a couple of shots.

This is the bulletscript im using:

var BulletSpeed = 100;

function Start () {

}

function Update () {
transform.Translate(Vector3.forward * Time.deltaTime * BulletSpeed);
}

Thanx if one of you knows the answer!

You could also try setting delayed Destroy on them, after instantiate:

Destroy(bullet, 5);

or destroy them after they are not visible anymore,

Thank you Sir! It’s working perfect!

(And sorry for this question, i saw that there are alot more of the same questions, stupid me!)

Seeya!