Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

using delay() wont wait 1 second after the first time?

while true do
	wait()
print("fast print")
delay(1,function()
	print("slow print")
end)
end

I have a simple setup for delay. I want "fast print" to print as fast as the while true do loop and also have "slow print" only print every one second.

when the game runs slow print only waits once then it prints as fast as the fast print.

am I doing something wrong?

1 answer

✓ Accepted answer

Here's a wiki on when delay() was added.

Basically,

delay() == spawn() + wait()

So technically,

delay(1, function() print("slow print") end) is spawn(function() wait(1) print("slow print") end)

Delay doesn't yield the script so like execution time is not paused when doing delay() A better option would just put wait(1) before print('slow print')

This discussion is preserved as it was. New answers, comments, and votes are closed.