How to handle NetworkOwner/movement on a crewed ship with multiple players?

I am working on making these battleships not just move, but also have their turrets move.


I am using VehicleSeats for this project, where a VehicleSeat will be used to control the ship’s movement, as well as control the movement for the turret(s).

When someone becomes the captain of the ship, they also become the ship’s NetworkOwner, which is needed since I run the movement script for the ship via a LocalScript put inside the captain.

I do not have the turrets NetworkOwnership set when someone enters them, since I know that will screw up the captain’s, and therefore the boat’s movement will be screwed up.

However, when someone who isn’t/wasn’t the most recent captain tries to control a turret, the turret will not move, as seen below:

However, if the most recent captain attempts to man a turret, it works fine.

Obviously this will be a problem since I intend for this battleship to have a upwards of 6 crewmembers (captain, 4 turret gunners, and someone to fire ballistic missiles), and if only the captain can control everything due to NetworkOwnership, this is a problem.

I am wondering how games like Naval Warfare handle this - can anyone be of assistance?

I may just never set the NetworkOwner of the ship/turrets to anything - maybe just set it to “nil” so it doesn’t auto pick it.

This means I’ll have to run the ship movement for the battleships on the server, which may lead to performance issues if there’s a ton of battleships, lol.

Having the captan have network ownership of the ship is good.

I’m not sure about the specifics of network ownership in the cases of the different constraints (it might be possible to assign different owners to parts of the ship if they’re split by ball socket constraints), but otherwise:

  • You could have the turrets be separate assemblies (not connected at all), then have code on all clients and the server to center the turrets on their axis. This way, the clients can control the rotation and the rotation replicates, but on all clients the position is correct.
  • You can also skip replication all together and have remote events or unreliable remove events be used to control the turrets’ angles (with some smoothing/interpolation). (i.e. client in the turret sends angles through a remote event, the server sends the angles to all clients, the clients all replicate the angles)

How would I make the turrets be separate assemblies?

You would just have them be totally disconnected.

So each part in the boat would be welded to the boat, and each part in the turret would be welded (or constrained) to each part in the turret, but no part in the boat would be connected to a part in the turret.

Then with BindToRenderStepped you would adjust the CFrame of the turret on every client to line up with the turret mount of the boat.

And when a player gets in the turret (which would be unanchored) set the ownership to that player.