Avoiding wait() and why

I agree with this, but what about using it in the context of wait(5)? Do I have to create an intricate RunService.Heartbeat:Wait() solution such that I repeat that 300 times?

It says right at the top of the post.

Let’s talk about wait() . Not wait(n) (although if you are using small n values to where it’d be barely distinguishable from wait() , you’re probably going to hit the same issues mentioned in this thread).

you do know frame rate is always different making this bad practice

Ah okay thank you!

Also, I believe it is Delay(time, function)

yep that’s exactly what I said to them as well

1 Like

Luckily, you can use ModuleScripts so that you only write the code once.

May I know why are we returning these 2 values?

But I thought you said not to use wait() ever?

Please read the post. wait() is bad, but mostly because it’s doing long polling when you should be reacting to events.

So polling on events = bad

But on other cases, it’s good?

I’ve collected all my thoughts on this in the original thread.

1 Like

I’m sorry but I still have some questions in my head I’m just asking if wait() is really useless or useful in certain cases?

Oh my god am I a necrobumpers :sob:

Anyways, is ‘delay’ unreliable? Just wondering :smiley:

delay runs on the same task scheduler as everything else, apparently there’ve been some improvements but I don’t see myself ever using it again.

1 Like

Functionally, it’s pretty similar to wait. although one thing i’ve noticed is that it implements a small jitter of around 0.005(?) to the point you tell it, if you delay something a bunch of times, you’ll eventually see it in action.

I’d say it’s probably functionally useless though, it’s lacking in ergonemics in the sense that any use case outside of ‘delay & forget’ is basically impossible (lack of interface, can’t ‘undelay’ or anything like that.), and you also can’t pass arguments to the function you’re delaying, which makes things a lot uglier.

Thanks for the info on wait(). By the way, it will be run is the correct sentence not “it will be ran”.

Good news!

wait() is now getting deprecated! task.wait() is now the new method of waiting!

2 Likes

I think this new library is really amazing

1 Like

Finally the war between the wait team and the heartbeat team have ended in peace xD

2 Likes

I’m still not sure if this library function suffers from the same issue as normal Heartbeat wait functions… which is if you have many wait calls, the scheduler might get all crazy, because you’re resuming a new thread for each wait call every heartbeat, and doing checking everytime;

Waiting for a response on that on the task thread.

(seems like yes nvm)