I’m creating a bullet script and the only thing that I cant figure out is destroying multiple cloned objects. Ive gotten as far as destroying one of them but after more are spawned the script cannot catch up.
bullet.js
var bullet : Rigidbody;
var speed : float = 10.0f;
var muzzlePoint : Transform;
function Update() {
if(Input.GetButtonDown("Fire1")) {
var instance : Rigidbody = Instantiate(bullet, muzzlePoint.position, muzzlePoint.rotation);
instance.velocity = muzzlePoint.forward * speed;
Destroy(GameObject.Find("Bullet(Clone)"), 5);
}
}