Hey guys,
so i’ve heard that using task.wait() is better then wait(), since wait() is outdated. My game has over 100 wait() functions so I’m a little bit worried if I have to change every wait() function. Can someone tell me the difference between wait() and task.wait()?
Thank you!
The difference is wait() stalls the current thread preventing other stuff getting processed
task.wait() queues the current thread to resume when other stuff has finished processing.
task.wait() is faster than wait() so Yes, you should change it.
wait() is deprecated but can still be used to maintain old games. a Quick way to change all your wait() to task.wait() is
Click that button
and change it here.
wait is ok
task.wait is just more accurate
Wait is used still wayy too much roblox needs to show the warning line
I didnt know this function even exists! This will help me so much!
So that means task.wait() is the same thing, it only queues the thread differently (and this is the reason why it is working better)?
Yep, even roblox core guis still use wait()
Hey so I have a question:
This shows that my game has many wait( functions. Since Roblox Core Scripts also use wait in their scripts and things like Heartbeat:Wait() only work with wait() I’m scared I could break my game…
Is there a way to clarify the things you want to change?
Short answer no. there is nothing you could do about it, There is isn’t anyway to blacklist one of them.
You could change the Heartbeat manually though or stick with wait() , task.wait() is faster But wait isn’t that bad. It’s only faster by milliseconds and wait() isn’t going to be gone any time soon.
Put this at the top of your script
local wait = task.wait
RBXEVENTSIGNAL:Wait() is not the same as just wait(). Or at least it you can’t use task.wait for it.
That won’t work it thinks that wait() is the actual wait timer, It only replicates when you rewrite the wait().
Yep.
Incorrect. wait() is not deprecated but rather is classified as legacy. Depreacated is where it is not supported and over time will very likely break. Roblox still supports wait() (well it does not need support really) it is just that it is now recommended to use task.wait() as it is faster then wait().
To provide this point even more, if you check the docs it does not say wait() is deprecated unlike somthing like the point service which is.
An even simpler solution would be to place the following line of code at the beginning of all your scripts that use wait:
local wait = task.wait