local Equipped = false
script.parent.Equipped:Connect(function()
Equipped = true repeat wait(1) script.Parent.Power.Value = script.Parent.Power.Value - 1 until Equipped == false script.Parent.Unequipped:Connect(function() Equipped = false end)
end)
when i unequip the tool it keeps subtracting power
You had combined the two functions. I've also cleaned up the formatting and used a while loop to make it much neater.
local Equipped = false script.parent.Equipped:Connect(function() Equipped = true while Equipped do script.Parent.Power.Value = script.Parent.Power.Value - 1 wait(1) end end) script.Parent.Unequipped:Connect(function() Equipped = false end)