Should the client or server move parts?

I’m working on a game that involves obstacles containing moving parts.
I want to avoid having parts that appear “lagged” to the clients because players must interact with the parts (stand on them, avoid touching them, etc).
This popular roblox game has accomplished a simular affect.
https://www.roblox.com/games/1962086868/Tower-of-Hell

The moving parts in the game above seem to be replicated to the client as they get out of sync for each player. I’m using cFrame to move the parts on the server right now.

Is replicating moving parts to the client the best way to prevent “laggy” movements or is there a way to move parts on the server and make sure all players see the same movement, even players with bad internet connection?

3 Likes

I think you might want to do it on the Server side, so that all players could see it at the same time, but I don’t think it would be a bad idea to do it on the client side.

1 Like

It depends on how the movement of these parts affects core gameplay.

If you want more leniency for the player, then have the client move the parts. If you want accurate/uniform part movement across all players, then move them on the server.

I would also like to recommend using TweenServiceV2, which ensures that tweening is replicated smoothly from the server across to the client.

Hope this helped! :smiley:

6 Likes

Is tweenService the best thing to use on parts that will be moving back and forth or rotating around over and over?

I would like the moving parts to stay in sync but it’s higher priority for the client to see the part where it actually is.

1 Like

Yes, tweenservice is the best way to go for looped motions like the ones you’re describing.

Given that the client should see the parts where they actually are, I would recommend having the client move the parts themselves.

edit: For rotations, I personally use part.CFrame = part.CFrame * CFrame.Angles(x,y,z) then rotate it every frame using game:GetService('RunService').Heartbeat or RenderStepped.

3 Likes

Thanks for your replies. I will experiment with moving parts from the client and I will look into tweenServiceV2 it looks like it might be a helpful module.

1 Like

It would be a terrible idea in my opinion to do this on the client side because if it was client sided I believe the for example spinny wheel thing you have to jump on to get to the other side would be spinning at a different pace and then you would be seeing other players on the spinny wheel but at a different pace an then you could run into them so you should do this on serverside.

Non-problem. Can be resolved by tween syncing, collision filtering or otherwise, but visual effects should be handled by the client, especially in regards to tweening. The server is not designed to be able to smoothly generate an arbitrary amount of intermediate values and have something glide across them; some of those will be skipped or jittery and that gets worse the less performant your game is.

If you’re looking to be smooth and proper, then you should be using the client for these kinds of things.

3 Likes

Hey, sorry for the bump. But I was just wondering with regards to this question, as @colbert2677 mentioned

could you elaborate this part? How can I make the client see the correct position but also that it doesn’t look weird for the server? Thanks!