What's diffirence between wait() and task.wait()

When I’m trying use wait() and task.wait(), I’m don’t see any difference between them. When I’m go to Developer page about task, I’m don’t understand what they mean. Can someone explain me what’s difference between this two wait()?

2 Likes

wait() is about to go deprecated
task.wait() is more accurate than wait()

2 Likes

Like someone else mentioned, task.wait is just faster and better, I am pretty sure ( correct me if I am wrong ) that is is equivalent to using RunService.HeartBeat:Wait().
the function wait is just bad practice nowdays, I never used wait again ever since I discovered task.wait()

3 Likes

task.wait() is essentially just wait but based in roblox’s heartbeats
ex. wait() can only go to wait(1/30) while task.wait() is dependant on fps, so you can go up to task.wait(1/60) or higher if the user is using fpsunlocker

1 Like

My only peev about the new task.wait is they have made it longer. Now we have to type 5 extra characters… :face_with_symbols_over_mouth:

2 Likes

As other replies said already, task.wait is essentailly twice as fast if you provide no number in the brackets (it waits 1 frame)

Though be careful, as doing a loop like this:

while true do
    task.wait()
    -- do something
end

It will continue to run even when the script is disabled/destroyed
(this is a bug, it will be fixed soon)

1 Like