[Post deleted by author, support no longer needed]
1 Like
My scripting skills aren’t that good so I don’t know how to edit your script but I can give you a solution.
Create two NumValues, one for the MaxAmmo and another one for the CurrentAmmo.
Everytime you reload, make the CurrentAmmo.Value == MaxAmmo.Value
Everytime you shoot, make it so that CurrentAmmo.Value -= 1
And when the CurrentAmmo.Value == 0, make it so you can’t shoot until CurrentAmmo.Value >= 1
If CurrentAmmo.Value >= 1 doesn’t work, try CurrentAmmo.Value > 1 or CurrentAmmo.Value == 1
1 Like
Whenever you intend to add ammo use the math.min()
function.
gun.Ammo = math.min(gun.Ammo + 50, 100) --Set gun's ammo to its current ammo plus 50 or 100 (whichever is least).
math.min()
provides a way to clamp a value’s size.
1 Like