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

How can i make a wait so people cant spam the tool activation?

Asked by
danglt 185
6 years ago

so this is for so poeple cant use auto clicker but i cant figure out where to add a wait so people cant do that

1function clicked()
2    print("hi")
3end
4script.Parent.Activated:Connect(clicked)

1 answer

Log in to vote
4
Answered by 6 years ago
Edited 6 years ago

You would make a debounce.

1local clickable = true
2script.Parent.Activated:Connect(function()
3    if clickable then
4        clickable = false
5        print("Clicked!")
6        wait(1)
7        clickable = true
8    end
9end)

It basically waits until you can click again by adding a bool value :)

Ad

Answer this question