My suggestion for handling the lag between players in race games

As you know when u are racing a player you often deal with their echo which is a sort of delayed version of their player’s car.

My suggestion is this…

The player will tell the server exactly where they will be according to their ping

the server tells the other clients to CFrame that players car in front

1 Like

there is a delay when the client tells the position to the server and then there is a second delay when the server tells the other clients where the position is

the delay is different for every player

you can use Player:GetNetworkPing to get the ping

“Ping” is a measurement of the time taken for data to be sent from the client to the server, then back again

so we can try to guess where the car will be but will not be perfect

local car = ...

local player = -- the player who has network ownership of the car
local halfPing = player:GetNetworkPing() / 2
local carPosition = car.Position + car.AssemblyLinearVelocity * halfPing
print("maybe car is here for server:", carPosition)

local player2 = -- the player we want to send the car position
local halfPing2 = player2:GetNetworkPing() / 2
local carPosition2 = carPosition + car.AssemblyLinearVelocity * halfPing2
print("maybe car is here for player 2:", carPosition)

but this will not work well when the driver does sharp turns or sharp breaks and accelerations because we cant guess the future and we have no idea that the driver decided to turn or do a sharp break etc… but if the driver is going at a constant speed then the guess will be good

1 Like

quite unfortunate

but i love the effort u put into this