Raycast Shooting Firerate?

Hi, so I’m making a first person shooter and I have a shooting script using raycast, here it is

#pragma strict

function Start () {

}

function Update () {

if(Input.GetButton("Fire1")){
var fwd = transform.TransformDirection (Vector3.forward);
    if (Physics.Raycast (transform.position, fwd, 1000)) {
        print ("There is something in front of the object!");
    }
}
}

It works just fine but it fires every frame and I want to put a fire rate on it so it will fire a certain amount of shots a second. Any ideas? Thanks in advanced.

You can make yourself a little timer. (Pseudocode follows…)

var timeSinceLastShot : float = 0f;
var timeBetweenShots : float = 1 / (shots per second);


void Update() {
   timeSinceLastShot += Time.deltaTime;
   if(timeSinceLastShot >= timeBetweenShots) {
      shoot();
      timeSinceLastShot = 0f;
   }
}