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

function clicked()
    print("hi")
end
script.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.

local clickable = true
script.Parent.Activated:Connect(function()
    if clickable then
        clickable = false
        print("Clicked!")
        wait(1)
        clickable = true
    end
end)

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

Ad

Answer this question