the motive:
the request:
player:GetNetworkPing()
, when called in-studio, returns the value stored at IncomingReplicationLag
(instead of returning 0)
or
player:GetNetworkPing(): number
player:GetNetworkPing(useStudioIncomingReplicationLag: boolean?): number
takes an optional boolean that’s only respected when called in-studio:
player:GetNetworkPing(true)
--- ... when in-studio, reads & returns `Settings.IncomingReplicationLag`
--- ... otherwise, returns `player:GetNetworkPing()`
obviously useStudioIncomingReplicationLag
is long and i’m sure that a smaller, more concise name can be cooked up
the yapping:
the code gymnastics required to simulate what player:GetNetworkPing()
would return in-studio shouldn’t exist
here i am requesting a behavior change or addition to the vanilla player:GetNetworkPing()
method that would allow network latency to be read properly when called in studio. it would satisfy cases such as:
--- because player:GetNetworkPing() doesn't read IncomingReplicationLag,
--- simulate 200ms latency
--- the value passed into this function has to be changed *every time* IncomingReplicationLag is changed :/
--- as there is no way to read that setting using the roblox game api
--- if this function had a smell it would stink up the entire calling environment
--- returns latency \
--- pass `studiolatency` to account for studio sessions not reading IncomingReplicationLag
local function readlatency(player: Player, studiolatency: number?): number
return RunService:IsStudio() and (studiolatency or 0) or player:GetNetworkPing()
end
… or cases where developers still use a ping-pong remote to measure remote latency