VehicleSeat Unreliable - Sometimes Doesn't Work

VehicleSeats seem to have an issue where they don’t always work when using VehicleSeat:Sit(humanoid). This does successfully “sit” the character, but the controls don’t seem to be capturing. For instance, the HUD doesn’t show up & trying to steer/throttle the vehicle does nothing.

I haven’t been able to properly reproduce this yet. It always happens in a game server – I haven’t experienced this in Studio yet. And it seems sporadic. I don’t know what triggers it. Sometimes it works, sometimes it doesn’t. There are no logs/errors to show.

Other developers have informed me that they have experienced this issue too. It doesn’t seem to be a new issue. I don’t know how long it’s been an issue.

I have tried to hack my way around this in various ways, such as adding a couple of seconds of delay between spawning the car and sitting the character. Nothing seems to work.

I have been experiencing this at my “truck test” place:


The relevant code on my end is the following. I’ve taken out stuff that doesn’t matter:

-- Server-side script. This is a snippet within the vehicle spawner.

-- Give ownership to the player:
truck.Parent = trucksFolder
truck.PrimaryPart:SetNetworkOwner(player)

-- Create a VehicleSeat:
local seat = Instance.new("VehicleSeat")
seat.CFrame = truck:GetPrimaryPartCFrame() * CFrame.new(0, -3, 0)
seat.Parent = truck.Body

-- Weld seat to truck:
local seatWeld = Instance.new("WeldConstraint")
seatWeld.Part0 = seat
seatWeld.Part1 = truck.PrimaryPart
seatWeld.Parent = seat

-- Sit the humanoid after an arbitrary 0.2 second delay:
wait(0.2)
seat:Sit(humanoid)

TL;DR - Sometimes VehicleSeats don’t properly capture user input (e.g. changing SteerFloat/ThrottleFloat properties), nor show the HUD, thus it seems like a VehicleSeat-related bug. This happens when using VehicleSeat:Sit(humanoid). Sometimes it works, sometimes it doesn’t.

16 Likes

Can confirm this happens! Happened to my game earlier this week. :+1:

2 Likes

This happens a lot in Vehicle Simulator, along with another (Possibly related) bug. We automatically seat the players into a new vehicle if they spawn another car when already in a car. It waits to seat until the seat’s disabled property is set to false (Which signifies the chassis code is loaded all the way). Sometimes the cars won’t move, and if you hop out/hop back in (Funny part is using :Sit() still, server-side), it’ll work.

Also, sometimes the values of throttle float/steer float will ‘stick’, like a sort of tweening. If I alternate between pressing A/D and/or W/S, it takes a second to update the values, or it’ll set to 0 and then switch over, causing lag in steering/undesired behavior.

3 Likes

This is an annoying bug with my train control system, while the client scripts load correctly. Some of the modules which use .Throttle to detect key inputs do nothing.

1 Like

I’ve been experiencing this bug in both studio and game servers, and it’s plagued me for quite some time.

I looked through the control modules and might’ve found the cause:

The Humanoid.Seated event doesn’t reliably send the “currentSeatPart” parameter when used on the client, probably because the client hasn’t received info about the VehicleSeat’s existence yet. Since the ControlModule relies on this parameter to tell if the humanoid sat in a VehicleSeat or not, you get your issue. It thinks the humanoid is sitting on nil.

image

This seems to happen far more often when loading vehicles with high part counts. I’ve created a repro for this bug here:
VehicleSeat Bug Repro.rbxl (50.1 KB)

Theoretically, you can work around this bug in your game by waiting until the client has received data about the VehicleSeat before calling Seat:Sit. Alternatively, you could edit the ControlModule to use GetPropertyChangedSignal(‘SeatPart’) instead of Seated to run ControlModule:OnHumanoidSeated.

2 Likes

I’ve had a similar issue for around a year now. I don’t use any code to force the player to sit. I just allow the player to sit via touching the seat.

From what I’ve diagnosed from countless hours trying to debug:

  • Not easily reproducible
  • The seat has changing values but the control script isn’t picking it up for whatever reason.
  • Players with poor connection are more likely to be effected.
  • Only happens to cars using constraints.
  • After various talks with people from the physics team who’ve been working tirelessly on cars, both here on the DevForum in DMs and at RDC, none of them have ever seemed to experience this issue, nor do they have any ideas of what could cause it (no matter how many repros I’m able to provide or video proof of it)

I’m going to be an Accelerator in the Spring and my hope is while I’m there I might be able to get a bit more to the bottom of this while at the HQ. :sweat_smile:

1 Like

It wouldn’t by any chance have effect on vehicles using hinges, because I use them and my vehicles steering sort of dies out and functions oddly, only sometimes, other than that it works fine. It’s just started today.

Been also experiencing this, it happens quite a bit in my game. and also getting reports about being unable to maneuver vehicles.
IIRC the Changed event doesn’t fire for Throttle & Steer when this happens. Awhile ago I spent ages trying to figure out what was wrong because there were no errors to rely on. I thought it was something to do with NetworkOwnership, but in the end I just gave up because I couldn’t find a solution for it.
Relieved to know it isn’t something on my end. It’s annoying to say the least.