Recently I noticed some issues with some code and after some testing I found out something weird. For some reason when i print out RunService.Stepped’s deltaTime it shows me the time in seconds since the function was initially connected, instead of the time between frames
Code:
game:GetService("RunService").Stepped:Connect(function(dt)
print(dt)
end)
Output after one minute:
If you try to do the same with Heartbeat and RenderStepped, the values do correctly show the deltaTime. weirder yet, if you try getting the deltaTime using the tick() method in a Stepped function you also get correct values.
code:
deltaTime = 0
lastTick = 0
game:GetService("RunService").Stepped:Connect(function()
deltaTime = tick() - lastTick
print(deltaTime)
lastTick = tick()
end)
Output after one minute (stayed the same since the start):
Is this intentional behavior? Am i overlooking something or is this not supposed to happen?