How let my machinegun(like the deathmachine in cod black ops) to shoot a projectile one after the other??

Here's the code

` var colpi : float;//colpi in totale var tempo: float;//tempo tra un colpo e l'altro var colpo_fuori : GameObject;// copertura del proiettile var projectile : Rigidbody;// proiettile che esce dalla canna var Spawn1: Transform;// var Spawn2: Transform; // var Spawn3: Transform; // var Spawn4: Transform; //Le 6 zone dalle quali spara la mitragliatrice var Spawn5: Transform; // var Spawn6: Transform;// var Shoot_Bullet_Speed : int; // velocit dei proiettili var BulletCount : int; //Ammount of bullets remaining in the clip var MagCapacity = 999; //The maximum capacity of bullets in the clip

function FixedUpdate () { if (Input.GetButton ("Fire1") && BulletCount >= 1) //check to see if ready to fire { clone1 = Instantiate(projectile, Spawn1.position, Quaternion.identity); clone1.AddForce(transform.forward*Shoot_Bullet_Speed);

    clone2 = Instantiate(projectile, Spawn2.position, Quaternion.identity);
    clone2.AddForce(transform.forward*Shoot_Bullet_Speed);  

    clone3 = Instantiate(projectile, Spawn3.position, Quaternion.identity);
    clone3.AddForce(transform.forward*Shoot_Bullet_Speed);  

    clone4 = Instantiate(projectile, Spawn4.position, Quaternion.identity);
    clone4.AddForce(transform.forward*Shoot_Bullet_Speed);  

    clone5 = Instantiate(projectile, Spawn5.position, Quaternion.identity);
    clone5.AddForce(transform.forward*Shoot_Bullet_Speed);  

    clone6 = Instantiate(projectile, Spawn6.position, Quaternion.identity);
    clone6.AddForce(transform.forward*Shoot_Bullet_Speed);      

}

}

`

Try this:

var projectile : Rigidbody;
var shotPower : float;
var fireRate : float;
private var lastShot : float;
function Update ()
{
    if(Input.GetButton("Fire1") && Time.time > lastShot)
    {
        lastShot = Time.time + fireRate;
        Shoot();
    }
}
function Shoot()
{
    var go : Rigidbody;
    go = Instantiate(projectile, transform.position, transform.rotation);
    go.velocity = transform.forward*shotPower;
}

What's happening is each time you shoot, it sets the last shot to the current time plus the fire rate, so that when it checks if Time.time is greater than last shot, it is during that frame. Hope it helps!!! :)

Or you could use the handy InvokeRepeating.

   var fireRate : float = .3;
   var delay : float = 0;

   function Update()

   {

      if(Input.GetMouseButtonDown(0)) {

         InvokeRepeating("Shoot", delay, fireRate);

      }

      if(Input.GetMouseButtonUp(0)) {

         CancelInvoke("Shoot");

      }

    }

    function Shoot() {

      //Your instantiate code here

    }