CFrame Movement Lag


#1

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?


#2

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.


#3

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.


#4

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


#5

How often is the loop running?


#6

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.


#7

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.


#8

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.


#9

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.


#10

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.


#11

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?


#12

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.