Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Need Help With A Tool Debounce I Need You To Help Script It?

this is my code

local tool = script.Parent

   
tool.Activated:Connect(function()
	if tool.Parent == game.Players.LocalPlayer.Character then
		script.Parent.RemoteEvent:FireServer()
		
	end
end)

can you add a debounce please? Thanks?

1 answer

Next time, you should try to make your own attempt. This is not a request site.

local tool = script.Parent
local debounce = false
local cooldown = 1 --Set this to your preferred cooldown.	 
	 
tool.Activated:Connect(function()
	if tool.Parent == game.Players.LocalPlayer.Character then
		if not debounce then
		script.Parent.RemoteEvent:FireServer()
		wait(cooldown)
		debounce = true
		end
	end
end)

Don't forget to accept the answer if this helped!!

This discussion is preserved as it was. New answers, comments, and votes are closed.