the thing i need help with is pretty easy, its just how to do so players cant spam the EXP getting, i tried adding debounce but its not working, help?
local debounce = false
local Spirit = script.Parent
Spirit.Touched:connect(function(entity)
if entity.Parent.Name == "WaterEssence" and game.Players:FindFirstChild(entity.Parent.Parent.Name)and debounce == false then
local Man = entity.Parent.Parent.Parent
local RealMan = game.Players:FindFirstChild(entity.Parent.Parent.Name)
local Bro = RealMan:FindFirstChild("leaderstats")
local EXP = Bro:FindFirstChild("EXP")
EXP.Value = EXP.Value + 10
print(EXP.Value)
local debounce = true
wait(20)
local debounce = false
end
end)
thanks
EDIT think i found the problem, maybe its because at the start of the script it says "local debounce = false" so maybe anytime i run the script it goes back to false. can someone tell me how to fix this?

2 comments
Is the problem that the players can still get xp or that they can't get xp at all.
replace "local debounce" with just "debounce" in the function only.