Is there way to get time delay between script and physics?

script working faster then physics process.
so, i have to delay script but i don’t know the amount to delay.

how to get delayed time between scripts and roblox physics engine?

i tested and 0.1 was similar but not correct

this video from @happyfloppy6

but my situation is, slowing the stick thing.
how can i get time to delay?

i know how to delay. i need the time.

1 Like

You’re probably looking for the small delay between the processing steps on each frame.

You could get the delay by subtracting the value of tick() at the signal of RunService.RenderStepped from the value of tick() at the signal of RunService.Stepped

The issue here is the minimum task.wait() time is 16 ms (one frame) so even if you got the delay, if its being used in a task.wait, its useless.

Maybe try waiting for the stepped signal before doing any processing if the script is executing things too early. RunService.Stepped:Wait()

i will use task.delay()

so…

local DelayTime

RunService.Stepped:Connect(function()
	local StepTick = tick()
	RunService.RenderStepped:Connect(function(StepTick)
		DelayTime = StepTick-tick()
	end)
end)

like this?

1 Like

wait. my script working on normal server script.
so i can’t use RunService.RenderStepped:
and there is no relation on ping or rendering
i tested with 1000 ping but same result with 100 ping.

just server problem.
delay from between script process and server physics process

https://developer.roblox.com/en-us/api-reference/event/RunService/Stepped

Stepped fires one frame prior to the physics simulation.

https://developer.roblox.com/en-us/api-reference/event/RunService/Heartbeat

Heartbeat fires one frame after the physics simulation.

local run = game:GetService("RunService")

while true do
	run.Stepped:Wait()
	local timer = tick()
	run.Heartbeat:Wait()
	print(tick() - timer)
end

image

as i tested, it should be 0.1~0.15

0.0001? too small.