Workspace:StepPhysics() causes lag when used on character rigs

Using this code below, you can replicate an issue that causes FPS drops when using the StepPhysics API:

  • Before running this, make sure there is a rig named “Rig” in workspace. It may need to have some accessories for this issue to occur.
  • Also, make sure the rig is in the air. It will not cause any lag while the rig is stationary on the ground. The lag will occur while it falls or moves.
for _ = 1, 300 do
	workspace:StepPhysics(task.wait(), {workspace.Rig.HumanoidRootPart})
end

This issue started happening around April 2025, when people began reporting issues for my Play in Studio plugin that uses the StepPhysics API to allow users to walk around in studio while they build. This bug completely breaks my plugin that people paid for, and is totally out of my control to fix.

More on this.
This occurs only when stepping physics at RunService.Heartbeat, task.wait() or anything else that’d resume the script after when physics normally are resumed.
Stepping physics at RenderStepped is fine.

Microprofiler also seems to shows nothing particularly interesting, despite very obvious jittering and fps drops.

Hi! Thank you for reporting this. Do you mind sharing a repro file for us, and steps to repro the issue? Thanks!

This works as a quick fix for my plugin, thanks.

Here’s a repro file + the code in command bar for this
stepphysicslag_repro.rbxl (99.8 KB)

local parts = {workspace.Rig.PrimaryPart}
game:GetService("RunService").Heartbeat:Connect(function(dt)
	workspace:StepPhysics(dt, parts)
end)