Issues with gun shooting not working

Hello,
I have a feeling that it has to do with something like the buildup of “pause” but i’m not quite sure.
heres the LINK
if you press (a) (to shoot) then it should shoot. and if you press (b) then it reloads, but every once in a while it will reload and the just break and you cant shoot.

Thanks

  • Blobiy

Yep, you are completely correct about the cause; every time you press B it is queueing a button event and that event can’t run until the last one finishes. To work around it, you can use a “timer” instead of pause. In other words, instead of this code:

do something like this:

I created a variable named “ReloadTimeEnd” and set it equal to the current running time PLUS the amount of time for the reload. Then, inside the on game update I keep checking the current time to see if it has passed when the reload should have ended

thanks, i thought it was divided and then saw that. thanks to much @richard!!