Handling multiple timers in a single script/module

Yes you are correct. It will be ran alone until it end then goes to the next function.

Unless you use a coroutine like this.

function Lobby1()
    for i=1,30 do
        wait(1)
    end
end
function Lobby2()
    for i=1,30 do
        wait(1)
    end
end

coroutine.wrap(Lobby1)

Coroutines basically make a new thread allowing a function to run freely without disturbing the code beneath it.
From what I have heard, coroutines are automatically garbage collected after they end running (in luau) so no need to worry about memory leaks on that extent.

2 Likes