Why should I care which event I use? Putting a 5 second yield in a RenderStepped connection does not have an actual difference as to using Stepped/Heartbeat, apart from the fact that the cycle starts a fraction of a second prior.
The only difference is the order of events from server birth. Adding a regular event every Heartbeat/Stepped/RenderStepped will cause that event to run every ~X seconds, no matter the event it was bound to. This is logical.
If you’d want the player’s camera to be updated every frame, there would be no difference at allapart from the camera update cycle starting a fraction of a second earlier/later after server birth whether you used heartbeat/stepped/renderstepped. The time inbetween the updates will always be the same. Before/after physics simulation does not matter, even if you missed the first sim, you’ll catch onto the second, and third, and so on.
RenderStepped does not run in parallel to Roblox’s rendering tasks and code connected to RenderStepped must be executed prior to the frame being rendered. This can lead to significant performance issues if RenderStepped is used inappropriately. To avoid this, only use RenderStepped for code that works with the camera or character . Otherwise, RunService.Heartbeat should be used.
Stepped
The Stepped event fires every frame prior to the physics simulation. The step argument indicates the time that has elapsed since the previous frame.
As Stepped fires every frame, it runs on a variable frequency . This means the rate will vary depending on the performance of the machine. If the game is running at 40 FPS, then Stepped will fire 40 times per second and the step argument will be roughly 1/40th of a second.
Heartbeat
The Heartbeat event fires every frame , after the physics simulation has completed. The step argument indicates the time that has elapsed since the previous frame.
As Heartbeat fires every frame, it runs on a variable frequency . This means the rate will vary depending on the performance of the machine. If the game is running at 40 FPS, then Heartbeat will fire 40 times per second and the step argument will be roughly 1/40th of a second.
You should mainly stick to Stepped and/or Heartbeat in cases where you aren’t working with the character or camera. Stepped is suggested by Roblox.
Here’s a question for you… If I have 20 different parts in a game that needs to use the heartbeat loop, does it matter if I have 20 different heartbeat loops in a game or should I try to process them all in a single heartbeat loop. Does 20 heartbeat loops slow down my game?
Don’t forget, connections take up memory and it may be a bit of a micro-optimisation to try condense, but you shouldn’t worry as long as you are disconnecting and connecting only when you need to.
You haven’t actually explained anything. I would not be asking this question if I did not do some research first.
“I still don’t see what the difference is, slap the same code onto each of these events, and it would work exactly the same, apart from the fact that they will run a fraction of a second after server birth.”
It all depends what you’re using it on, there’s no correct answer out of the blue if you can’t even tell us what you’re doing with it, it all depends on what you’re using it for (which I explained above).
That being said, the answer is very clear.
Only use RenderStepped for code that works with the camera or character . Otherwise, RunService.Heartbeat should be used.
If nothing has changed about the way these events are sequenced, this should be accurate. Use case is still accurate even if the pipeline is different from what I remember.
Stepped (number Elapsed, number DeltaTime) ; Server & Client
Runs before Physics is simulated. Runs at a max of 60 FPS, even if client is using FPS Unlocker.
Good for physics/character based actions, such as CFraming objects that need to follow the character reliably.
RenderStepped (number DeltaTime) ; Client Only
Runs before the screen render. Runs at whatever FPS the client is currently running. 60 FPS normally, but FPS unlocker will effect RenderStepped.
Ideal for visuals, such as auras, GUI effects, or animating parts. Can be used for character purposes for smoother interpolation, but Heartbeat is more suited for that.
Heartbeat (number DeltaTime) ; Server & Client
Runs after the screen is Rendered and Physics is simulated. Runs at whatever FPS the client is currently running. 60 FPS normally, but FPS unlocker will effect Heartbeat as well.
60 FPS max on Server.
Also ideal for visuals, such as auras, GUI effects, or animating parts. Is also a very good option for animating character related objects when a smoother interpolation is desired.
You clearly don’t know anything about this topic. The answer is not clear at all. Please do not carrying on this reply chain, or carry on giving answers related to that context.
Take Roblox’s advice, they inform you for a reason.
To sum this up:
RenderStepped: Used for camera and character-related stuff
RenderStepped does not run in parallel to Roblox’s rendering tasks and code connected to RenderStepped must be executed prior to the frame being rendered. This can lead to significant performance issues if RenderStepped is used inappropriately.