I need an alternative to Network Ownership for client tweening an anchored part

I’m working on a system that relies on Tweens on the client to move a board.

The board is tweened through Keypoints, and at the end of each tween (tween.Completed), it detects whether the player is “touching” the obstacle or not and either increases or decreases the tween’s speed (.Touched itself does not work with anchored parts or parts welded to them, it uses :GetTouchingParts() and both the obstacle and player have a custom hitbox).

That being said, I’d like the board’s position to be replicated to the server, so other players can see the board moving as well. The problem is that :SetNetworkOwnership() simply doesn’t work on anchored parts (even if you anchor them only on the client, after setting the ownership on the server). Tweening the part without anchoring replicates the movement, but the part “wobbles” every so often because of physics.

Doing the tweening through the server isn’t an option as the movement is not as smooth for the player and hit detection would have a considerable delay as it’s also detected on the end of each tween and relies on player input, and tweening on each client isn’t an option, since tween speeds are constantly changing based on whether they hit an obstacle or not and individual characters also replicate their own client positions.

My issue would be solved if :SetNetworkOwnership() replicated tweens done to anchored parts in the client, which is not the case!

Any ideas on what I could try?

You could try running the tweens locally and then passing back replication data to the server to render its position for other clients. (assuming it’s just a visual thing.) I’m not sure how your system is built, but if it’s the kind of thing where each board has an ‘owner’, then that client will be responsible for sending replication updates to the server to update that board instance for other clients to whatever position the client is passing through. Again, this should be just a visual thing.

Probably your best bet if you don’t want to play around with BodyMovers or other methods that would use physics (unfortunately I can’t recommend a reliable option)

Do you think it wouldn’t be bad performance wise for the client to be doing all of those tweens at the same time, with the assumption that I’d be sending tweening info to all clients on every tween from keypoint to keypoint?

Update with solution: Add a bodyvelocity set to 0 velocity and very high force so the part will not be able to move with normal physics but it doesn’t count as anchored so network ownership still works!

1 Like