I often use to read some Lua code to improve my knowledge about this scripting language. And in this kind of situation I see that a lot of people use task.wait(). Which is more often met than wait(). But after all what is the difference between them?
1 Like
wait(x)
runs at 30Hz, while task.wait(x)
runs at 60Hz. This means that task.wait(x)
is a lot more precise with timings. So in basically every case, you should use task.wait(x)
over wait(x)
.
Here’s some more information about the task
library if you’re interested:
It also gives you a brief overview of the way task.wait(x)
acts over wait(x)
as well.
2 Likes
Additionally to this, wait()
is a lot less precise (internally it seems not to count the time passed, but something else, which results in the yield time varying heavily)
1 Like
Also, wait()
is deprecated and task.wait()
depends on the user’s FPS.
1 Like