How to make the player stay the same speed regardless of lag?

When the game lags a lot it says its going 16 studs per second but its only really like 4

You cant really just “solve” lag, its a client sided issue.

it can be solved by changing the walkspeed to something higher but idk how to calculate how fast it needs to be

Use deltaTime for that in RunService.RenderStepped:Connect(function(deltaTime) end) deltaTime is the time that it took for a frame to render.

so what to do with the delta time