Any scripts that would give a cooldown to this?

So I just need a cooldown for a sound in a tool, I already gave the animation a cooldown for it, though now I just need a cooldown for the sound.

Script:

local tool = script.Parent
local sound = tool:WaitForChild("Sound3")

tool.Activated:Connect(function()
	sound:Play()
end)
local tool = script.Parent
local sound = tool:WaitForChild("Sound3")
local canPlaySound = true
local cooldownTime = 2

tool.Activated:Connect(function()
	if canPlaySound then
		canPlaySound = false
		sound:Play()
		task.wait(cooldownTime)
		canPlaySound = true
	end
end)

Do you mean a debounce like this?

1 Like

something like that, yeah, it’s because the animation has like a whole cooldown sort of thing.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.