wait resumes the script on a Stepped event. Since Heartbeat happens right after Stepped, it makes sense that the delta is smaller.
Basically, the first snippet is measuring the distance between one Heartbeat and the next - which as you can see is roughly 60 FPS. The second snippet is measuring the distance between Stepped and Heartbeat, which is smaller because it’s measuring the start and end of one frame, rather than the end of one frame to the end of the next.
If you use task.wait instead of wait, you will see that it looks identical to your first snippet: 60 FPS. Why? Because task.wait resumes immediately after Heartbeat fires, you’ll once again be measuring the distance between two Heartbeats.
local runService = game:GetService('RunService')
while true do
task.wait(1)
local clock = os.clock()
runService.Heartbeat:Wait()
print(os.clock() - clock)
end
But oh interesting, I was told that task.wait resumes on Heartbeat, but for me it’s still printing incredibly low numbers like 0.000035999983083456755. Guess I was wrong there.
But why is this a problem? I explained to you what is happening. If Figma will start working instead of being a useless piece of crap I can make an explanatory image.
i need to slow my visible movement.
cause the visible movement is faster then physics process.
and the difference between visible movement and physics process is 0.1~0.15 second
Take a look at this chart. It graphs timing data collected by a Script. As you can see, the distance between a Stepped and Heartbeat is only about 0.1ms, which is around 0.0001 seconds, which is around what you observed. The difference between the first and second Stepped is ~16.75ms, or 0.01675s, also close to what you observed. Same with the Heartbeats.
Obviously a huge chunk of time is cut out of this chart due to just HOW HUGE 16ms is at this scale.