Is wait() or task.Wait() better? What are the pros and cons?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to know the pros and cons of task.wait() vs wait().

  2. What is the issue? Include screenshots / videos if possible!
    Even though i’ve heard task.wait() is better, i would like to know why.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried looking around in the dev forum for a while.

1 Like

wait() is found in a group named “Roblox Globals”, and is apparently deprecated.

I believe Roblox started “taskifying” the default functions just like wait()
(for example, spawn() is also deprecated, and its replacement is task.spawn(), or delay() with task.delay())

I don’t see much difference with either of the functions, but the task functions are the ones that are up to date, while the deprecated functions have a chance of being removed entirely anytime.

2 Likes

Oh, so if roblox studio updates there’s a chance wait() will break?

I think it’s safe to say that.

Alright. Thanks for the replies.

1 Like

wait() automatically waits for the next frame update, while task.wait() uses a timer to wait for a specified amount of time or until a specific task or coroutine has completed its execution.

I use task.wait() for pretty much everything. I have found a few cases I had to use wait() however.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.