local Debounce = false local tool = script.Parent local player = script.Parent.Parent.Parent function onTouched(hit) if not Debounce then tool.Activated:Connect(function() player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 1 end) Debounce = true wait(.2) Debounce = false end end script.Parent.Handle.Touched:connect(onTouched)
Here is the script. i dont know why it dosent work im a beginner. please help.
Ok so pretty much you did the debounce wrong you should do it inside of the first function, like this.
local Debounce = false local tool = script.Parent local player = script.Parent.Parent.Parent tool.Activated:Connect(function() if not Debounce then Debounce = true player.leaderstats.Gems.Value = player.leaderstats.Gems.Value + 1 wait(2) Debounce = false end) end end script.Parent.Handle.Touched:connect(onTouched)