CFrame Movement Lag

Hello, I was wondering how I could fix multiple parts moving creates lag. If I had about 20 normal parts (no unions etc…) and they start moving they lag. If more players show up then it’ll lag more. How could I fix this?

Assuming you’re talking about moving anchored parts with CFrame…

Your implementation may be inefficient, can you provide scripts as to how you’re going about doing this? It would help more.

I have something that functions similar to how you’re describing, and I can support well over 200 moving parts with no lag.

You’re probably moving them on the server very often. This is not advised due to the (fairly) low replication rate of 20Hz (unless I’m wrong, maybe it just applies to remoteevents). I would recommend moving the parts locally when the server tells the client to.

Just using a basic loop is all. It moves the cframe a certain amount then it moves it back.

How often is the loop running?

This is most likely your problem, Jamie. I made this mistake when moving a bullet tracer to quickly on the server side which lagged everyone out. To avoid this I just had the server send the info to the client and now the clients individually “render” the tracers. If that makes any sense.

1 Like

I am moving a bunch of parts to make an agility course. Yes they are moved often, but how could I reduce lag on this? If I make it client then users will see other users floating around.

I think TweenService is great because it guarantees(?) that even if your movement is choppy it will be done in x amounts of seconds. To me, it’s a lot more reliable than just using loops.

It is not impossible to do that without TweenService. You just need to have a loop with an arbitrary amount of steps rather than a fixed amount of steps, where it waits a frame every loop iteration and determines how much time has passed since the start, and then set/stop the operation.

Ah. I am a simple being, as you can tell. I feel like either way TS would be faster since it uses a Roblox function, but I have no clue how that works.

I would do TweenService but it seems like a lot of extra work that needs to be put in to play… just to move a few bricks?

Nah, it’s easier for me than running on loops and stuff. The most annoying part is setting everything up, but after that it’s so much easier than relying on CFrame alone.