Predicting player position in postsimulation jittering for other clients

for _, player in game.Players:GetPlayers() do
	local character: Model = player.Character or player.CharacterAdded:Wait() and player.Character
	local rootPart: BasePart = character:WaitForChild("HumanoidRootPart", math.huge)

	local time: number = 0.2

	local part = Instance.new("Part")
	part.CanCollide = false
	part.Transparency = 0
	part.Size = Vector3.new(1, 1, 1)
	part.Anchored = true
	part.Parent = workspace

	local hl = Instance.new("Highlight")
	hl.Adornee = part
	hl.Parent = part

	local prevPos: Vector3 = Vector3.zero
	
	game:GetService("RunService").PostSimulation:Connect(function(dt)
		local currPos: Vector3 = rootPart.Position
		local velocity = (currPos - prevPos) / dt
		prevPos = currPos
		
		part.Position = rootPart.Position + velocity * 0.2
	end)
end

Im attempting to predict every players position
In the video, on the screen of the client, the client’s predicted position is smooth and still while other peoples positions are jittering back and forth

Anyone got a fix?

Jitter is expected due to the replication latency. To mitigate this, you can use lerping to smooth out the movement instead of setting it immediately:

-- adjust the 10 as needed
part.Position = part.Position:Lerp(rootPart.Position + velocity * 0.2, dt * 10) 

Your solution works fine on lower velocity, however it fails as velocity increases because it takes a bit to update

Is there any way to grab a player’s position before interpolation?
What I am thinking:

	local from = Vector3.zero
	local to = Vector3.zero
	
	local delta = os.clock()
	local last = 0
	
	local t = 0
	
	rootPart.[[OnClientRecieve]]:Connect(function(newPos)
		local now = os.clock()
		delta = os.clock() - last
		last = now
		
		from = to
		to = newPos
		
		t = 0
	end)
	
	game:GetService("RunService").RenderStepped:Connect(function(dt: number)
		t += dt
		part.Position = from:Lerp(to, t / delta)
	end)