shoot script help

can someone help me out with this script
i want to make one shell come out of the gun
everytime the w key is pressed.
right now its the right mouse button and seems to fire multiple shells when i hit it.

var projectile : Rigidbody;
var speed = 20;

function Update () {

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

clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));

Destroy (clone.gameObject, 3);

}}

thank you for viewing

wayne

Change your if ( Input.GetButton (“Fire1”)) to if (Input.GetKeyDown(KeyCode.W))

Something like this:

var projectile : Rigidbody;
var speed = 20;

function Update () {

if(Input.GetKeyDown(KeyCode.W)) {

var clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));

Destroy (clone.gameObject, 3);

}
}

To make it fire one shell at a time, change GetButton to GetButtonDown. to change the button, go to the main menu, go to edit, go to project settings and click input. in the inspector, fo to the top of the list, and click “Fire1”. change the positive and alternative positive fields to w by clicking on them and typing in the letter W.
hope this helps!