why will my shooter script not work i copyed and pasted it of youtube but when i put it in a java script and tryed to put it on my gun it will not work?

plz help

That’s definitely a bad way to post a question: the title should contain a brief description of your problem (like “Shooting script not working”, for instance), and the question should explain the problem and include your code.

About the problem: this script works, despite some bad practices (clone should be explicitly declared). The script must be attached to some scene object to work: drag the script from the Project view to the camera - this way the bullet goes in the direction you’re looking at. Select the camera and drag the bullet prefab (which must have a rigidbody) to the field Projectile in the Inspector, and voilà: it must work

var projectile : Rigidbody; 
var speed = 10;

function Update () {
  if ( Input.GetButton ("Fire1")) {
    var clone: Rigidbody = Instantiate(projectile, transform.position, transform.rotation);
    clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));
    Destroy (clone.gameObject, 5);
  }
}