How Can I Replicate Local DragDetector Movements To The Server?

I’ve spent the morning trying to use DragDetectors to drag unanchored parts around in Geometric mode, but I’m having a difficult time getting perfect behavior and I’m wondering if there’s a better way.

In essence, the dragging must happen on the client for responsiveness, but it must be replicated to the server so it knows where the objects are and can react accordingly (and so other players can see the item).

My current workflow is this:

  • When a drag starts, the client tells the server to give it network ownership over the dragging item. This stops some wonky behavior that would otherwise occur at the end of a drag.
  • Every frame, fire an unreliable remote to the server with the new object position.
  • The server receives this position and fires all other clients (excluding the origin client) with the new position. This prevents the change on the server from causing the dragging client to stutter.
  • At the end of the drag, a reliable remote event is fired and the instance’s CFrame is directly set on the server, syncing up all clients including the dragger. The network ownership is released.

However, this solution is not only pretty complicated (and probably easy to exploit) but at the end of the drag, no matter what I do, there is always a stutter when the server reclaims control and sets the part’s CFrame to sync everything up. I release the drag and the part falls to the ground, then the server updates and the part reappears in the air and falls to the ground again.

Some other things I’ve tried:

  • Using two drag detectors with the same drag function, one on client and one on server. It has severe stuttering issues, probably the two detectors fighting each other.
  • Just setting network ownership and letting Roblox replication handle it. This does not work in geometric dragging mode because the object is anchored.
  • Setting network ownership and using physical dragging mode. Unfortunately the movement of the object in physical dragging mode is just not what I want to matter how I adjust the properties. It also stutters both when the drag starts and ends - the start is probably the split second it takes to receive network ownership (whereas my current solution is always showing the client’s opinion of the drag position during the drag, regardless of network ownership) and the end is once again the server taking control of the object position similar to my current solution.

Dragging objects around is going to be a core mechanic of my game so I want it to feel perfect. If I can just figure out how to avoid the stutter at the end of the drag with my current solution, I’ll be happy with that. If there happens to be some solution to this that I haven’t figured out, I’d love that as well.