Hello developers, Today I’ve made a tool that gives you +10 health for every time you click it but I also made a debounce for it so you can’t just spam click for infinite health. But it doesen’t quite work how I want it to. For example if I am 10/100 health and I keep spam clicking then after a second I get a bunch of health .
Here’s the script:
Debounce = false
if Debounce == false then
Debounce = true
end
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild(“Humanoid”)
local Tool = script.Parent
local Debounce = false
Tool.Activated:Connect(function()
if not Debounce then
Debounce = true
Tool.Parent.Humanoid.Health += 10
wait(1)
Debounce = false
end
end)
local Tool = script.Parent
local Debounce = false
Tool.Activated:Connect(function()
if not Debounce then
Debounce = true
Tool.Parent:WaitForChild("Humanoid").Health += 10
wait(1)
Debounce = false
end
end)
local Debounce = false
local tool = script.Parent
tool.Activated:Connect(function()
if not Debounce then
Debounce = true
local humanoid = tool.Parent:FindFirstChild(“Humanoid”)
humanoid.Health = humanoid.Health + 10
task.wait(1)
Debounce = false
end
end)