I am making a lazier gun which rechargers over time if you have fired it at least once.
Here is the code I got for recognizing the guns Ammo and MagSize is lower to 6. If it is its suppose to run the loop and plus 1 onto the Ammo and MagSize values every 2 seconds till till it reaches 6 again.
local Ammo = script.Parent.Parent.Configs.Ammo.Value
local MagSize = script.Parent.Parent.Configs.MagSize.Value
local Tool = script.Parent.Parent
Tool.Equipped:Connect(function(Recharge)
if Ammo < 6 and MagSize < 6 then
Recharge = true
end
end)
while Recharge ==true do
if Ammo >= 6 and MagSize >= 6 then
Recharge = false
else
Ammo = Ammo +1
MagSize = MagSize+1
wait(2)
end
end
PS the value Ammo is for the gui display, while MagSize is the guns ammo. There both a set value stored in a separate folder for easy access later.

1 comment
Thank s for that. But I think the problem is in a different script