What do you want to achieve? Ammo subtraction, depending how many times the player shot his gun (2 times, 5 times etc…)

What is the issue? I cannot figure out how to do so.

What solutions have you tried so far? I have tried looking over youtube, devforum, I’ve also tried using an function that tracks how many times the gun is used, and therefore subtract the ammo from the player’s gun.

When reloaded your ammo gets substracted by the amount you used, 2 bullets or 4… my problem is I cannot figure out how to do so, any help is appreciated!

so basically it’s simple stuff but since you have issues about maximum subtraction, you can use this formula

symbols:
a = the amount of ammos in a mag
aM = the remaining extra ammos u have
maxA = the maximum ammo amount

if aM <= 0 then return end -- voids if they aM isn't a natural number
repeat
a += 1 -- adds by 1, also negating aM
aM - 1
until a >= maxA or aM <= 0 do -- this will guarantee to fire once the a is now full or the aM reaches 0

i haven’t tested this out so let me know if it doesn’t work and also i’m pretty sure it’s not the most utilized or optimized code but you can seek for later help when the proper people come

Okay, will try it out! thanks… also you didn’t have to do the whole thing for me as I have it figured out, i just needed help with the ammo substraction