Sound Tool Debounce Cooldown

So I made a sound tool that plays a sound, and the debounce is supposed to prevent it from playing until the wait() is over, but it’s not working

function equip()
	if debounce == false then
		debounce = true
		wait(10)
		debounce = false
	end
	script.Parent.Handle.Sound:Play()
	
end

script.Parent.Equipped:connect(equip)

When using debounce you but the code inside the if statement
script.Parent.Handle.Sound:Play() would be located here instead

function equip()
	if debounce == false then
		debounce = true
	    script.Parent.Handle.Sound:Play() -- It would be here instead
		wait(10) -- You would have to wait 10 seconds until hearing the sound again
		debounce = false
	end
end

script.Parent.Equipped:Connect(equip)
2 Likes

If you want more information on debounce there’s an article about it here: Debounce Patterns | Documentation - Roblox Creator Hub

i was actually reading over it before.