i recently made a gun but when the clip value is higher than the MaxAmmo Value, MaxAmmo goes in negatives
just like this 12/-4 how do i fix it to where it cant go to negatives and so you cant reload at 0 ammo
this is my reload function:
EDIT: YES I TRIED CHANGING FROM MATH.MIN TO MATH.ABS AND IT DIDNT WORK
local function Reload()
if not Reloading then
if SpareAmmo > 12 then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and script.Parent.MaxAmmo.Value > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
ReloadTrack:Play()
Reloadd:FireServer(Player)
wait(ReloadTime)
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
script.Parent.MaxAmmo.Value = script.Parent.MaxAmmo.Value - ammoToUse
UpdateAmmo(AmmoInClip)
WeaponGui.Reload.Visible = false
else
SpareAmmo = 0
end
Reloading = false
end
end
end

4 comments
Post your script please
I edited it so now u can see it
Is this your script
^ nope but i converted it to FE and now im having this issue