What did I wrong with my gun script???

I maded a Gun script but all my bullets don’t hit somthing they just fly through everything. Can someone help me??

Here’s the script:

var projectile : Rigidbody;

var speed = 20;

var shootsound : AudioClip; var shootanimation : AnimationClip;

function Update(){

if( Input.GetButtonDown( “Fire1” ) ) {

animation.Play(“m4a1-shoot”);
audio.PlayOneShot(shootsound);
var instantiatedProjectile : Rigidbody =
Instantiate( projectile,
transform.position, transform.rotation
);

instantiatedProjectile.velocity =    transform.TransformDirection( Vector3(

0, 0, speed ) );

   } }

Are your bullets using colliders? If so, check the DontGoThroughThings script on the Unify Wiki.
Another method for a shooting script would be using raycasts instead, and overlay some particle effects on top to make it seem that you are firing real particles. There are plenty of resources on this topic, have a look around.