reloadtime

hello i dont know how i make a reloadtime on this script can u help me

var projectile : Transform;

var speed = 1;

var barrel : Transform;

var shootSound: AudioClip;

var shots :  int  =  0 ;

var maxShots :  int  =  8 ;

var reloadSound: AudioClip;

function Update () {

if ( Input.GetButtonDown ("Fire1") && shots < maxShots){
audio.PlayOneShot (shootSound);

clone = Instantiate(projectile, barrel.position, barrel.rotation);

clone.rigidbody.velocity = barrel.TransformDirection( Vector3 (0, 0, speed)); 
shots ++;

}
else if (shots >= maxShots && Input.GetKeyDown(KeyCode.R))
    {
audio.PlayOneShot (reloadSound);    
        shots = 0;
    }
}

Hi try using yield WaitForSeconds

public var ReloadTime:float = 2;

function Update () {
 
if ( Input.GetButtonDown ("Fire1") && shots < maxShots){
audio.PlayOneShot (shootSound);
 
clone = Instantiate(projectile, barrel.position, barrel.rotation);
 
clone.rigidbody.velocity = barrel.TransformDirection( Vector3 (0, 0, speed));
shots ++;
 
}
else if (shots >= maxShots && Input.GetKeyDown(KeyCode.R))
{
Reload();
}
}

function Reload(){
audio.PlayOneShot (reloadSound);
yield WaitForSeconds(ReloadTime);///Wait 2(ReloadTime) seconds before continuing
shots = 0;
}