Wait to Reload

if(Input.GetKeyDown (“r”)){

   Reload();

}

function Reload(){

	if(Clips > 0){
	
	PlayReloadAudio();
	
	yield WaitForSeconds( ReloadTime );
	
		BulletsLeft = BulletsPerClip;
		
			Clips -= 1;
	}

}

Guys, how do I “lock” key r during the reload? :confused:

Keep a boolean

var reloading = false;

then in your function Reload-

function Reload(){

    if(Clips > 0 && !reloading){

        reloading = true;
        PlayReloadAudio();
        yield WaitForSeconds( ReloadTime );
        BulletsLeft = BulletsPerClip;
        Clips -= 1;
        reloading = false;
    }

}

Thanks!!! :smiley: