Heartbeat fires before PostSimulation

The documentation for RunService.PostSimulation states that Following this phase, the engine triggers the Heartbeat event.

However, this does not appear to be the case. Based on testing, Heartbeat consistently fires before PostSimulation instead of after.

Running the following script shows that Heartbeat fires before PostSimulation every time.

local RunService = game:GetService("RunService")

task.spawn(function()
	RunService.Heartbeat:Wait()
	print("Heartbeat")
end)

RunService.PostSimulation:Wait()
print("PostSimulation")

Page URL: https://create.roblox.com/docs/reference/engine/classes/RunService#PostSimulation

Nevermind you’re correct it does always fire before Post Simulation

Guessing this was just copied from the Stepped page without making the necessary changes. This page shouldn’t have really any references to Heartbeat other than a note stating that PostSimulation is an intended replacement for it.

Afaik order should be something like:
PreRender → PreSimulation → PostSimulation

Which follows the same form as the previous:
RenderStepped → Stepped → Heartbeat

I’ll make a PR with the necessary changes when I get around to it (will update this post). It’s interesting that PostSimulation fires after Heartbeat, but I’m guessing thats just because more things are run before the event fires, which is likely why they made the move to begin with.

1 Like