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?

2 comments

0

I think I know what you mean. So you're trying to restart the timer if the button is pressed again yes?

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.