Rate of fire

I’m working on a script for guns in my game, and i’d like to customize the rate of fire. This script is for automatic weapons. How would i go about doing this?

var Bullet : Transform;
var Spawn : Transform;
var shellSpawn : Transform;
var shell : Transform;
var muzzleflash : Transform;
var BulletForce = 4000 ;
var shellForce = 100 ;
var Sounds:AudioClip[];
var RateOfFire = 0 ;
 
function Update ()
{
    if(Input.GetButton("Fire1"))
    {
       Shot();
    }
}
 
function Shot()
{
    var pel = Instantiate(Bullet, Spawn.position, Spawn.rotation);
    pel.rigidbody.AddForce(Spawn.forward * BulletForce);
	var sel = Instantiate(shell, shellSpawn.position, shellSpawn.rotation);
	sel.rigidbody.AddForce(shellSpawn.forward * shellForce);
	Instantiate(muzzleflash, Spawn.position, Spawn.rotation);
	audio.clip = Sounds[Random.Range(0, Sounds.length)];
    audio.Play();
}

This should work :

var fireRate : float = 0.5;
var nextFire : float = 0;

function Update(){
if(Input.GetButton("Fire1")  Time.time > nextFire){
nextFire = Time.time + fireRate;
shot();
}
}

Intense_Gamer94’s solution works but is not frame rate independent. You can achieve that by using Time.deltaTime.

For example:

var Bullet : Transform;
var Spawn : Transform;
var shellSpawn : Transform;
var shell : Transform;
var muzzleflash : Transform;
var BulletForce = 4000 ;
var shellForce = 100 ;
var Sounds:AudioClip[];
var RateOfFire = 0 ;
 
var fireRate: float = 0.5;
var fireTimer: float = 0.0;
var canFire: boolean = true;

function Update ()
{
    if(Input.GetButton("Fire1")  canFire) {
    	canFire = false;
    	Shot();
    }
} 

function Shot()
{
    var pel = Instantiate(Bullet, Spawn.position, Spawn.rotation);
    pel.rigidbody.AddForce(Spawn.forward * BulletForce);
    var sel = Instantiate(shell, shellSpawn.position, shellSpawn.rotation);
    sel.rigidbody.AddForce(shellSpawn.forward * shellForce);
    Instantiate(muzzleflash, Spawn.position, Spawn.rotation);
    audio.clip = Sounds[Random.Range(0, Sounds.length)];
    audio.Play();

    StartCoroutine("ShotTimer");
}

function ShotTimer() {
	
	while(canFire == false) {
		fireTimer += Time.deltaTime;
		if(fireTimer > fireRate) {
			fireTimer = 0.0;
			canFire = true;
			break;
		}
		yield;
	}
}

It doesnt matter if its frame rate independent in this situation, as the fire rate is inferred by the user clicks.

intense_gamer offered a better solution.