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

Is there a solution to make a clickdetector react faster?

I made a script that works but it delays a little and it's just makes my game too bugged. The script is suppose to disable clickdetector after clicking ONCE. But people are able to click it more than once before disabling. Does anyone know a solution?

4 comments

0

lets see code pls

0

Its the script you gave me last question, the random one, i managed to make it work but unfortunately when I press it it delays the disable so that means ppl can press it until it does

0

Please prove the code if you need help as this is not natural behavior of clickdetector.

0

How exactly you lock out the action after a click depends on where this code runs, and how it needs to respond to more than one player clicking it. If the click is doing an action on the server, the delay is going to include a player's full round-trip ping time. Only client-side action-reaction can be super snappy.

1 answer

You should use a debounce, a debounce will help you make it so the code won't run more than once upon clicking the click detector it works like so:

local debounce = true
--CD is your click detector
CD.MouseClick:Connect(function()) 
	if debounce == true then
	debounce = false
	--code here---
end)

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