how do i make a gun reload

hey guys I’m making a zombie game but I need to make a code to reload the gun when you run out of bullets when you press R so can someone please help me
My Game:https://flowlab.io/game/play/1371197

@JeffyBoi123 you can use this as an example https://flowlab.io/game/play/1350185

I have an example as well if it helps:
https://flowlab.io/game/play/1278662

JR 01 your exapmple confused me

Its a bit more confusing because it knows that there is no ammo either when you run out or when you press R. You can Copy and Import the bundle to your game but ask about anything about the code if you don’t understand.

ok now how to make like a NPC companion and make it follow the player and attack the enimies

Thats a bit more complex, but I would focus on attacking enemies and following the player separately.
Then you would want to make it follow the player when its not attacking.

@“JeffyBoi123” I have an example for an NPC companion here. Although there is no reload function and that kind of stuff.