Module · Scripting core
task
Work spread over many frames. A task is paused automatically when it has run long enough for one frame, and task.wait pauses it for a while — the game keeps running either way.
task.spawn(fn: function, ...: any): Task
Starts fn as a background task, passing any extra arguments.
task.spawn(function()
for i = 1, 100 do
spawnWave(i)
task.wait(1)
end
end)task.wait(seconds?: number): any
Pauses the current task for a number of seconds; 0 waits for the next frame. Only valid inside a task.