making bullets disappear when they collide

when by bullets hit the wall they don't disappear, how can i make them disappear on collision? all answers are appreciated. (thanks) ;)

you should write something like this on your bullet prefab:

function OnCollisionEnter(){
  Destroy(gameObject);

}

If AliAzin's code isn't working, perhaps your bullet object is moving too fast for Unity to pick up the collision, you can try setting the collision detection on your rigidbody to "Continuous Dynamic".

However if you want my two cents as a developer, for bullets or other fast moving projectiles you should use raycasting. But perhaps if you want the bullet to actually travel through the air you can get more complicated with it by raycasting from the old position of your bullet to the new position of your bullet each frame to see if you missed anything during the physics iteration. :) hope this helps!

function (OnCollisionEnter)
{
Destroy(gameObject);
}
This is how you write it.
Has problem though it says to put a “;” at the end of the final line.
Which results in another error that says:
Expressions in statements must only be executed for their side-effects.