One of the ways to do it:
Add boolean instance variable to the gun, let's name it "cooldown"
and another number global variable, let's name it "Shoots"
Keyboard on Space pressed ---- Gun Spawn bullets - and add 1 to global variable
Gun Cooldown is True
System global variable = 8 ------ Set cooldown to false - wait 5 seconds - Set cooldown to true - Set global variable to 0
System trigger once