1/120 Wait
Hello all! I’m introducing something neat I found while playing around with LuaU, it allows instructions to run twice within a frame, but evenly spaced out as if it was 1/120th of a second, and even 1/180 of a second in the client. But it’s definitely not perfect, right now so I’m hoping better scripters in the community can improve upon this if they care to do so.
How Does It Work?
Heartbeat and Stepped both run within the same frame (and RenderStepped in the client). What happens is that these services are put into a table and then looped to run when Heartbeat fires and then run when Stepped fires, both within the same frame, changing a number value when both waits fire so that when a “Changed:” event is hooked it is fired around 1/120 of a second.
Credits to zeuxcg and Fractality_alt for the Image:
Here’s a video in it in action
What Is This Useful For?
Due to the ever growing world of events and tweening and connect() and whatnot and not needing to check for something every frame anymore, not much, but it can definitely be used to fire something as fast as possible be it a gun or calculations (As long as it’s optimized). It could also be used for more accurate wait times (Wait ~3/120th of a second instead of having to wait 1/30th of a second).
It’s uncopylocked, enjoy.