Feedback on Yield module - Alternative to using wait()

Hello, I am requesting feedback on a new module I made. It is very simple, and function nearly the same as wait(). The key difference is when using wait() without any number inside of it, it will go with the smallest number possible, whereas in yield(), it will use RunService’s Heartbeat, which is usually 3 times faster. Also, there is an option for a second parameter, where you can input a start time. It only accepts os.clock(), so be careful not to use tick(). The startTime will be used when counting how long to wait.

Actually, upon further inspection, the yield module seems to win every time. Check this place out for proof, then go to ServerScriptService>Event>Controller, and change the number there to test it.
Any feedback is appreciated.
https://www.roblox.com/library/6352256777

yieldTest.rbxl (40.4 KB)

Why couldn’t you just use RunService.Hearbeat:Wait()? This seems like a lot to make a whole module for. It would make sense to make a full module for this if you were using a completely different stack management method such as a binary heap.

Here’s a custom wait module:

Well, another thing is that Heartbeat relys on the player’s framerate, so if they are laggy, it will be slow. I incorporated code for that. Also, another reason why I made this is so you can put a custom startTime to make counting more accurate. Although, you provide a good point. Another option could be that Roblox actually just fixes the wait to make it way more efficient with resources and wait times to be more accurate. Thank you for feedback though!

1 Like