The problem So i have a gun script that adjusts a value called Ammo every time the function ToolActivated() is called the thing is that i want to subtract from that value each time i click not just the first time i clicked. Does anyone here know a way to make it so i can continue subtracting from a intvalue even after i did it once code
local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local Ammo = script.Parent.Values.Ammo.Value
local status = game.StarterPack.DevGun.Values:WaitForChild("Ammo")
local ShootDelay = script.Parent.Values.ShootDelay.Value
local debounce = false
function ToolActivated()
if debounce == false then
debounce=true
status.Value = Ammo - 1
wait(ShootDelay)
debounce = false
end
end
tool.Activated:Connect(ToolActivated)

1 comment
more explination I basicaly need it so each time i activate the tool it subtracts 1 from the value