VehicleSeat Unreliable - Sometimes Doesn't Work

@NoUniqueAddress
I finally, recently, figured out the issue here. It has to do with the player connecting to the seat but not receiving network ownership.

My reasoning behind this is that:
If you set the network owner of the vehicleseat to the player occupying it about a second after they get in the vehicle, this issue will not appear. I tended to find in the past that this issue typically happened to folks with poor connections more often than those with good connections, if that might also help narrow things down. Notably, it seems VehicleSeats are really finnicky with lag.

@MRKYLO20 Your issue [since I know your game RoStock Racing] is likely stemming from the fact you guys are using “Non-Vision Lag” scripts, where you’re setting the networkowner of the car to Nil [aka the server]. You’re likely doing this too fast after the player gets in the seat, so you’re severing the connection before it’s fully formed. Here’s a more improved version of that script I’m sure you guys are using.

local seat = script.Parent
local Players = game:GetService("Players")

seat.Changed:Connect(function(prop)
		if prop == "Occupant" then
			local humanoid = seat.Occupant
			local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
			seat:SetNetworkOwner(player) -- set network owner to the player FIRST to make sure the connection is made instead of hoping the automatic connection takes hold
			wait(.5) -- added wait to make sure the connection is made
			seat:SetNetworkOwner(nil)
	end
end)
1 Like

This is an ongoing issue. To reproduce this:

  1. Parent vehicle to ReplicatedStorage

  2. Parent vehicle to Workspace via Script while simultaneously using :Sit() on the VehicleSeat and player’s humanoid.

  3. After being seated, you will notice that all controls are lost.

1 Like

As I alluded to, the issue is not obtaining NetworkOwnership correctly.

In your case, add a workspace:WaitForChild(car) to your code that’s parenting the car to workspace and then call for the Sit function.

Notably, your instructions only reproduce the issue sometimes. Only users suffering from lag would get an “everytime this happens” result.

Setting the network ownership did not fix the issue, I just tested this.

I am on Windows 11, if that helps.

I can reproduce this consistently by basically spamming A and D, I am on Windows 11. Here is me using the on-screen keyboard only (no physical keyboard used) and the seat steer (and maybe throttle, untested) alternates between 0 and 1 or -1

Can confirm, it would glitch even if everything is replicated in workspace, and even if it’s a VehicleSeat sitting on the ground, it’s broken

That’s a different bug you’re talking about. Keep oscillation bug issues to the oscillation bug thread.

That is a different bug compared to the one on this thread. Post about that bug here: VehicleSeat Throttle/Steer oscillation on single tap of an input key during frame lag

This thread you’re posting on has to do with the seat becoming disconnected after getting into it and thus not accepting input. The bug you’re talking about is the oscillation bug. Two separate bugs, two separate threads.

The setting of network ownership fixes the disconnection bug, not the oscillation bug.

1 Like

Hey everyone!

A fix for this was just released. Please update this thread if anyone continues to see this issue.

Thanks!

2 Likes

hey, uh, did this fix happen to break sitting entirely?
i would post a bug report on this but i can’t because no one can be upgraded to regular anymore.

anyway, seats and scripts that force the player to sit no longer work. players just… can’t sit. it doesn’t happen.

2 Likes

Hey, the change was reverted.

Can you send me the place that broke?

Thanks!

1 Like

this appears to have fixed it!
this occurred on multiple places, as multiple users were experiencing the issue, so it appears it was site-wide. do you still want me to dm you the place where i first encountered this bug?

Yes, please send the places you experienced this issue.

Thanks!

1 Like

Just a heads up I’m still experiencing this issue and there is no fix in place (atleast for me)

3 Likes

I am still experiencing this issue as well.

2 Likes

Still happening for me as well.

3 Likes

bumb, im still experiencing this bug, i clone the vehicle from RepStore to a folder in the workspace and then use :Sit() but the player cant controll the vehicle. If the player jumps out of the seat the player cant enter it again by walking over the seat

I think I found a solution that fixed the problem for me. In a local script, I waited for the vehicle to load using ContentProvider:PreloadAsync({VehicleSeat}). After it loads, I fire a RemoteEvent to the server where a server script will call VehicleSeat:Sit(Humanoid). Here is the code:

Local Script:

game.ContentProvider:PreloadAsync({seat})
task.wait()
seat:WaitForChild("IsLoaded"):FireServer()

Server Script:

seat.IsLoaded.OnServerEvent:Connect(function()
	seat:Sit(humanoid)
end)

In my game, I put a RemoteEvent name IsLoaded inside the VehicleSeat. Sometimes it didn’t finish loading the RemoteEvent when I called it so I used WaitForChild to fix that.

1 Like

to anyone who still relies on vehicleseat, read this

roblox moved away from having “use-case” classes years ago because it goes against game engine design principles

in 2008, we had glue, capture flags, skateboards, vehicleseats, build tools, hinges
not made using scripts but hard-coded into the engine as classes
Instance.new(“SkateboardPlatform”)

the only supported modern class in this category would be the proximityprompt

but that was added in order to make ClickDetectors redundant because they caused a bad user experience on mobile (you can’t tell what is clickable on mobile with clickdetectors)

in modern roblox, just like in any other game engine, the classes are puzzle pieces that make up something functional when scripted

vehicleseat is the only one of those 2008 examples that isn’t deprecated because of it’s continued use in games, and i don’t expect roblox to continue fixing it, it literally uses deprecated weld objects to attach people to the seat

i think someone made a VehicleSeat2 chassis that is scripted and offers more control, maybe look into it

expect clickdetector and vehicleseat to deprecate eventually

3 Likes

The VehicleSeat issue still occurs.

Recreating the problem can be tricky since it rarely happens. It usually occurs when a player joins the game, and it might be connected to high ping or server (client?) lag, but I’m not entirely sure.

There’s also another issue (though I’m not entirely sure if it qualifies as a bug), where occasionally, when a player is automatically seated upon joining, it disrupts the seating animation.

Broken:
image

How it should look like:
image

While writing this message, the VehicleSeat didn’t properly seat my humanoid. When this bug occurs, the HUD doesn’t show up, and I cannot drive the ATV but sitting animation is being played. (When this happened there were no errors/warnings in the console at all.)

Here is the picture:

Code:

Players.PlayerAdded:Connect(function(player: Player)
	player.CharacterAdded:Connect(function(character)
		local ATV = Assets.ATV:Clone()
		local targetPosition = game.Workspace.Stages[player:WaitForChild("leaderstats", math.huge).Stage.Value].CFrame.Position
		ATV.Parent = game.Workspace.PlayersATVS[player.Name]
		ATV:SetPrimaryPartCFrame(CFrame.new(targetPosition) * CFrame.Angles(0, math.rad(-180), 0))
		spawn(function()
			repeat task.wait() until player.Character:FindFirstChild("Humanoid")
			repeat ATV.ATVSeat:Sit(player.Character.Humanoid) until ATV.ATVSeat.Occupant == player.Character.Humanoid
		end)
	end)
end)

If you want to try the game yourself here is the link to it: ATV [DEV] - Roblox

2 Likes