How does lag work with movement speed?

So I’m looking into making an anticheat to ensure players aren’t maliciously increasing their speed but one answer I wasn’t able to find was how lag worked with movement speed. Roblox has a setting that allows you to increase incoming replication time. I tried 5 seconds but even when doing that, my character’s movement stayed at around 16, not exceeding 17 studs per second.

image

The thing with this is that I’ve seen several videos and have seen myself instances of players teleporting around/having very finicky movements, not because they’re exploiting but because of poor internet connection.

I think the reason I am not seeing that teleporting effect is because even though ping is high there are no packets being lost possibly? Usually high ping correlates to low down/upload speeds but they aren’t always directly related (server location can influence it). So that leads my question to be what would be the math around calculating the amount of leeway for player movement using their ping? Or maybe any tools that would help simulate packet loss so I could just examine number of packets lost to their movement speed?

I believe roblox simulates lag by putting a wait() before an onserver event from the old Fighting Lag tutorial on roblox wiki before they changed it.

--Server script
Workspace.Blue.Target.Face.Touched:connect(function(projectile)
    wait(_G.artificialLag)    -- How Laggy Cannons creates artificial lag

    --Play target hit sound
    Workspace.Sounds.TargetHit:Play()

    --Update blue score
    blueScore = blueScore + 1
    Workspace.Blue.Scoreboard.SurfaceGui.ScoreLabel.Text = blueScore
end)

Perhaps to simulate lag spikes which is due to packet loss (perhaps IDK) you can put a math.random() in the lag perhaps to 2-3 seconds or longer. From personal experience I felt like it could last over 5 seconds.

Roblox actually has a setting that allows you to simulate high ping (Incoming Replication Lag) which I used, but I’m really just looking for what the maximum amount of movement a player can move in a second when factoring in ping and packet loss. From my tests ping doesn’t have any direct effect on packet loss and randomly guessing packet loss isn’t really the way to go for an anti-cheat wrt false positives I don’t think.