Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a solution to make a clickdetector react faster?

Asked by 5 years ago

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?

0
lets see code pls royaltoe 5144 — 5y
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 User#30241 0 — 5y
0
Please prove the code if you need help as this is not natural behavior of clickdetector. karlo_tr10 1233 — 5y
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. EmilyBendsSpace 1025 — 5y

1 answer

Log in to vote
0
Answered by
royee354 129
5 years ago
Edited 5 years ago

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)
Ad

Answer this question