Problems with Players Driving Boats

(I was unsure of where this should go in Development Support, but this seemed like the closest fit as there seemingly aren’t any scripts involved)

For context:
In my game I have several boats for players to use, differing in size, speed, and complexity. Most of the boats rely on buoyancy with terrain water to stay afloat (with variable adjusted density to get them to float at the right levels) and BodyAngularVelocity, BodyGyro, and BodyVelocity in a vehicleseat to actually move the boat.
However, one boat – the “Raft” – uses BodyPosition with a max force of 0 in X and Z in a single “main” part in order to keep it afloat, rather than relying on buoyancy.
The boats are spawned into the game from ReplicatedStorage by the players when placed.

The actual problem:
Many players of my game have complained about every boat except the raft not working, and I’ve experienced the bug yet have been unable to reliably reproduce it in any way despite its frequency. The raft always works, but the frequency of the bug with other boats has lead to players considering them completely broken.

When players place any boat, it floats and generally seems “non-broken”. Yet when players get in the vehicle seat of a boat afflicted with this bug, it just won’t move at all, in any way, from the player’s input. It can still be pushed around and isn’t anchored or welded to anything.
The strangest part of this bug is the fact that the bug appears to be per-boat, per-player. For example, Player A places Boat A and experiences the bug, yet when Player B tries to drive Boat A, they don’t experience the bug.

Here’s a screenshot of the afflicted boats:
image
The raft, the small single part and vehicle seat, is unaffected by the bug. The other boat – the Sailboat – is an example of the types of boats that are afflicted by the bug.

The best guess I have is lag, yet it doesn’t seem to account for the problem where the boats don’t move at all; it’s not just laggy movement, but no movement. For all I know, this may be an engine bug, but I don’t know anything so I’m not jumping to conclusions that it’s not my fault or just some quirk I’ve not noticed.
Does any idea how to fix this?

I’m probably not the most certified person to give you an answer. But you’d need to send the input of the player to the server VIA Remote Events to get the boat to move. As per Filtering Enabled if you aren’t already doing so.

However this is the wrong approach.

The best approach would be to handle the input on the client, and set the ownership of the boat to the player from the server. That way the player is authorized to enact his/her own clients physics on the boat. This cuts out the need for remote events. Though you should still be careful to check the boat server side in case someone may be cheating or speed sailing. Hehe.

3 Likes

Adding on to @T0ny’s wonderful response, here is a great article about Network Ownership (example 2):

Basically I would make it so when the server detects a player sit in the seat it gives them ownership. When they hop off ownership goes back to auto. You can use the code sample in the linked article as a reference.

I hope you find your solution!

(Then again, no movement at all is pretty weird… hm.)

Edit: Sorry, I accidentally replied to @T0ny instead of the actual post.

1 Like

Thanks for the help. I probably will end up coding a custom boat mover (honestly the VehicleSeat method was, while very convenient in terms of effort, very antiquated and not fitting with the rest of the game), though I’d always still appreciate an answer to why this happens with VehicleSeats.

Handling serverside checking is gonna be annoying considering lag, but hey, that’s a question for another time and board.

2 Likes

For my ship. A Tallship from the 19th Century. My first iteration anyways. I created my own custom seat. Technically it was a seat. but the reason I did it was to get a seat that you could stand up at. :slight_smile:

It worked like a charm. I even added my own GUI that said “Press E to Interact”.

There shouldn’t be too much lag really. You should do a lightweight check. If you wanna go into detail, you can do that once the lightweight check has triggered something suspicious if you really need to. Without the checks though, it’s actually easier because you simply modify the ship directly from the client.

1 Like