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

Help on restarting events & functions: How can I restart a function without it firing?

Asked by 2 years ago
Edited 2 years ago
clickDetector.MouseClick:Connect(function()
    print("Started")
    wait(10)
    print("Stopped")
end)

(That code is sample code, what I am really using it for is so a player gets healed once every second, 10 seconds after an event happens.)

How can I restart this function? In this code, how can I make it so that if the part is clicked again, the wait restarts without firing?

0
I think I know what you mean. So you're trying to restart the timer if the button is pressed again yes? Neatwyy 123 — 2y
0
Exactly, but I don't know how to pull that off. Also, It shouldn't fire if it is restarted in the middle of execution. DUCKONAROLL 0 — 2y

Answer this question