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?
Move local debounce = true to line 5 so it runs before you give EXP and see if that helps.
You should move debounce = true to between lines four and five. Your debounce will only work for one second after your 20 second delay, because the if statement will keep returning true until debounce is true, which you do after your delay. Good luck!