VehicleSeat does not register playing

First time posting, I hope this is the right category, at least it seemed most fitting in the list. Anyway.

I’m cloning a vehicle from a folder, and teleporting the player into the vehicle seat. This works fine 4/5 times, however sometimes, the VehicleSeat does not register the player has been put in the seat, and the vehicle won’t move. Gif showing issue:

If the gif doesn’t show properly, here’s a link: https://i.imgur.com/uUbQLJR.mp4

Here’s the part of the script that puts the player in the seat, I have no idea why the vehicle seat doesn’t register it sometimes:

tank.TankParts.VehicleSeat:Sit(player.Character.Humanoid)

tank is the vehicle object in workspace, and player is the localplayer

Have you tried using the HumanoidRootPart instead of the Humanoid?

It requires a Humanoid

I was typing in a rush to answer and did not realize this. Do you think there is an issue with the welding between the vehicle seat and the humanoid?

Perhaps there could be. I am not able to replicate the issue in studio btw, only in-game using the game client.

Have you tried setting the Network Ownership to the driver? You can do this by getting the VehicleSeat’s Occupant (VehicleSeat.Occupant) and setting it by using:

	local humanoid = VehicleSeat.Occupant
		if humanoid then
			local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
			if player then
				VehicleSeat:SetNetworkOwner(player)
			end

I have indeed, it is the next line.

tank.TankParts.VehicleSeat:SetNetworkOwner(player)

Though I’m not sure whether or not it works, but it doesn’t output any errors.

Is this code being run on a LocalScript or ServerScript? I ask this because you reference player as “localplayer” in the OP.

It is being run by a Script using RemoteFunction from a LocalScript, which sends over the player.

It would be most useful if you can post the important sections (preferrably in the OP) of the local and server script so I can analyze what you have not done/ what may have gone wrong.

LocalScript:

1 local Player = game.Players.LocalPlayer
2 local SpawnTank =  game.ReplicatedStorage:WaitForChild("RemoteFunctions"):WaitForChild("SpawnTank") 
3 local TankType = "Daimler_AC"

12 script.Parent.MouseButton1Click:connect(function()
14     local tankSpawned = SpawnTank:InvokeServer(TankType)
39     Player.Character.Humanoid.JumpPower = 0
40 end)

Server Script:

7 local Tanks = game.ReplicatedFirst:WaitForChild("Tanks")
8 local RequestTank = game.ReplicatedStorage:WaitForChild("RemoteFunctions"):WaitForChild("SpawnTank")
10 local function tankSpawnRequested(player, TankType)
12     local tank = Tanks.Daimler_AC:Clone()
13     tank.Parent = workspace
14     tank:MoveTo(workspace["MoveHere"..math.random(1,4)].Position)
15     tank.Name = "tank_"..player.Name
16     tank.TankParts.VehicleSeat:Sit(player.Character.HumanoidRootPart)
17     print(player.Name.." spawned a tank type: "..TankType)
18     tank.TankParts.VehicleSeat:SetNetworkOwner(player)
19     return tank
20 end
22 RequestTank.OnServerInvoke = tankSpawnRequested

Call :MakeJoints() on the tank after you parent it to the workspace and see if that makes a difference (in the server script that is)

If you are using constraints, it will work unless there is a different issue

Hopefully, you changed that to “Humanoid” as you mentioned before, a vehicle seat can only force a Humanoid to SIt.

Right, I changed it. And I will try to :MakeJoints() when I get a chance, I’ll let you know if it works.

1 Like

Check if any parts are anchored, as :MakeJoints() won’t work even if there is one anchored part.

For a second, I thought :MakeJoints() fixed it, but then it happened again. All parts are unanchored.

Could you provide a place file so we can see exactly what happens?

Alright, I think I’ve fixed it. I got the idea to anchor the main Part and then unanchor it after a second, and now everything seems to be working. Thanks for helping, that’s what made me get the idea.
There is another bug though, where the model likes to glitch, but that’s for another topic.

Please mark the thread as solution

I highly doubt this is the appropriate solution you’re looking for. This seems relatively hacky. A barebones file of the place you’re experiencing this issue in so we can analyse it would be very helpful.

Furthermore, whatever do you mean by “VehicleSeat does not register player”?