How do lag spikes work in Roblox?

(When answering, you do not need to answer every question, even answering one will help!)

What I am mainly trying to figure out is if you can save a players position every half a second, even through a large lag spike, where the player may look like they teleported (through local or server scripts.) To figure this out, I have some general questions I have struggled to find answers to.

To my knowledge, there are different types of lag spikes (having a low internet speed or low-end device.) I am using the word “lag-spike” to include both, if this difference matters, please mention it in your response.

General questions

  • Are local scripts still running during a lag spike?
  • If I hold a movement key during a lag spike, will I teleport to the new location as if I held the key for however long the lag spike lasts?
  • If I walk forward in front of a thin wall and a lag spike happens, will I go through that wall?
  • When players rubberband in Roblox, are their positions being quickly tweened, or are they being teleported?
  • If a players position is de-synced from the client to the server, will the player rubberband?
  • Can general lag stop or stall local scripts?
  • With a heartbeat function, will a local script run multiple times after a lag spike to catch up?

“Are local scripts still running during a lag spike?”

This heavily depends on the context as to what “lag spike” you’re referring too. If a user is experiencing high ping, then the client will continue to run. If a user is experiencing frame lag, then the current thread will only run at the pace of the frame rate itself. Meaning the thread could become throttled and experience interruptions.

“If I hold a movement key during a lag spike, will I teleport to the new location as if I held the key for however long the lag spike lasts?”

Yes, assuming we’re talking about high ping, no if we’re talking about client frame lag.

“If I walk forward in front of a thin wall and a lag spike happens, will I go through that wall?”

No, regardless of circumstances.

“When players rubberband in Roblox, are their positions being quickly tweened, or are they being teleported?”

Players don’t rubberband on ROBLOX as far as I’m aware, if they do it’s a games custom built anti-cheat by the creator.

“If a players position is de-synced from the client to the server, will the player rubberband?”

Refer above, not sure that players rubberband ever, movement is entirely client sided with no server interference, at least from ROBLOX.

“Can general lag stop or stall local scripts?”

Pauses the current thread until it completes whatever task its performing.

“With a heartbeat function, will a local script run multiple times after a lag spike to catch up?”

No.

1 Like

Technically yes. They could be the cause of the spike or potentially if something else is stealing all of my computers resources it might take a long time for the local script to be scheduled again. Remember that software takes turns running on the CPU so the script might not technically run for a while depending on the state of my system.

I believe so. Usually this is handled by multiplying the speed times the time between frames. That will effectively teleport you. However it might not handle all inputs in that time depending on how Roblox handles it. And note that some systems will cap the maximum delta time specifically to stop large teleports (I believe the camera does this)

Generally it’s a tween. Usually positions for items aren’t updated all the time and get tweened between several control points anyways.

Unless told not to, Roblox servers intrinsically trust clients and will always accept the position a client sent. So the client tells the server where they are and the server blindly tells everyone else. These messages are probably tweened, but I can’t say for sure.

Yes. If my computer has too many things fighting for CPU time I can end up completely stalling Roblox.

No. A stall would basically make stuff late. Trying to compensate would actually likely make the problem worse so systems usually drop it if they can.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.