Throttle events until end-of-frame?

Anyone know a good way to throttle something until the end of frame? Guessing maybe render stepped is the best way to do this, or to pick some marker event, but I was wondering if anyone else had a better idea, especially in terms of pushing stuff to the back of the stack!

Looking to collect UI events that might fire multiple times in a frame!

If you really want the end of each frame, then you probably want to use Heartbeat, see:
https://developer.roblox.com/en-us/articles/task-scheduler

However, if you want to collect UI events, this is probably a little late because it would incur a 1 frame delay to drawing the effects of those events. I would probably recommend using RenderStepped for that reason. User input is already processed before RenderStepped (as you can see in the article), so your code should be able to de-duplicate work from the effects of input and UI events there.

2 Likes