Hello. It has been a long time since I used the DevForum for help.
I’m following a tutorial on how to make an FPS game, but I have one major problem. The developer doing the tutorial hasn’t provided us with instructions on creating a limited maxAmmo. Thus, it has left me with one question: how do I make the limited amount of maxAmmo you have on your weapon?
Here is the code want to modify in the script, which follows the weapons from different module scripts.
Please do not hesitate to reply to me if you have any solutions.
You first need to make a variable with the total amount of bullets you currently have. After that, you add a if-logic next to the input.KeyCode == Enum.KeyCode.R statement, something like:
if input.KeyCode == Enum.KeyCode.R and framework.module.StoredAmmo > 0 then
After that, you can add, the following line AFTER the part where you do: framework.module.Ammo = ... that is, before the end.
Then replace StoredAmmo with reserved ammo? Make sure to add a variable called magazine capacity though. Ensure that it is used where you set the current ammo to reserved ammo.