Switch vehicle seats .. doesn't seat character leaves standing above seat

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Switch vehicle seats
  2. What is the issue? Include screenshots / videos if possible!
    initial touch part seats character in driver seat… I have humanoid.Sit = false
    and destroy seatweld to get character out of seat than Character:MoveTo(seatpart.Position) --seatpart is transparent part above seat
    wait(.4)
    seat:Sit(humanoid) --typical make you sit command
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    the below script you’ll see some works I’ve tried … lastly I’ve tried having a moveto part over a ontouched part triggering a sit which seems to not clue in … to give full picture …have vehicle with pilot and gunner seats a part that puts you in pilot seat then 2 buttons that switch you to gunner or pilot … this is closest I’ve got it to working yet character is left standing on top of seat until it somehow maybe hits seat and sits

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
below basically includes 10 different forum posts worth of how-to put in 1 script really thought the moveto part then dropping on touch part would work if all else failed but nope…

-- This is an example Lua code block
local button =  script.Parent

button.MouseButton1Down:Connect(function()
	--local player = workspace.Data.Player.Value --Get's player object and stores it in 'player' variable for server script use have tried both local and server scripts
 		
	local function gosit()
		local player = game.Players.LocalPlayer
		local Character = player.Character
		local humanoid = Character:WaitForChild("Humanoid")
		local GunnerSeat = Character.Functional.Gunner.VehicleSeat
		humanoid.Sit = false
		GunnerSeat:Sit(humanoid)  
	local	GunnerSeat2 = workspace:WaitForChild("Functional").Gunner.VehicleSeat
		Character:MoveTo(GunnerSeat2.Position)
		GunnerSeat2:Sit(humanoid)
--[[ --here I tried to make the standing character move in any direction to touch seat ... found possible seat cooldown to be possible issue but can use directional keys to move character to seat and it will sit...
		local slide = Instance.new("BodyVelocity")
		slide.MaxForce = Vector3.new(1,0,1) * 2000
		slide.Velocity = Character.HumanoidRootPart.CFrame.lookVector * -80
		slide.Parent = Character.HumanoidRootPart
		]]--
	end

	gosit()
	--wait(.4)
	--gosit()
end)
1 Like

Some headway made … I am finding that the following will get your character from 1 seat to another … here is scenario initial location is a modelname.Plane.Functional … which switches to character.Functional and reverts to workspace.Functional when exited… now for the ‘gunner’ it starts in modelname.Plane.Functional if pilot isn’t sitting if is it’s in character.Functional.gunner.VehicleSeat and when exited it’s in workspace.Functional …so it moves around quite a bit … and your script needs to figure all of that out…

	local Gunnerseat1 = Character:WaitForChild("Functional").Gunner.VehicleSeat
	Humanoid.Sit = false     
	Gunnerseat1:Sit(Humanoid) 
	local	GunnerSeat2 = workspace:WaitForChild("Functional").Gunner.VehicleSeat
	Character:MoveTo(GunnerSeat2.Position)
	GunnerSeat2:Sit(Humanoid)

now I don’t know why Gunnerseat1:Sit doesn’t just work … if anything it seems to break the connection … then you have to identify the next seat parented to character (this doesn’t exist until that point) from there the move and sit ‘somewhat’ works … still stands there … I have more trial and error testing going on … will hopefully have some solution or logic put to how his really works …topic has been up for near a week … not surprising this encompasses every forum post that remotely touches on the subject …

Things being looked at now
1: does a server script work better than a local script for this? doc doesn’t state this …both ‘work’
2: trying to make workaround where theres a 3rd seat (out of sight) that character goes to over top a touch part and drops the character on the touch part by destroying the seat … first try it didn’t work but was probably due to fact I tried putting it on vehicle above and was loosing itself in location (character.functional/workspace.functional) I do have logic check scripts that look at this kind of thing so will be trying those … there is a side issue that you need to store pilot name for another player to be able to access gunner when it’s in that character’s character.functional fixed by a value store
3: giving up and just having the avatar stand there until it sits/ disable the option which would suck / come up with another workaround

either way I’ll post it as I’m sure others have hit this wall

script.Parent.OnServerEvent:Connect(function(player)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
–local player = workspace.Data.Player.Value --Get’s player object and stores it in ‘player’ variable

local function gosit()
	--local player = game.Players.LocalPlayer
	local Character = player.Character
	local Humanoid = Character:WaitForChild("Humanoid") 
	------------------------------------------------------------
	Humanoid.Sit = false  
	local GunnerSeat2 = workspace:WaitForChild("Functional").Gunner.VehicleSeat
	Character:MoveTo(GunnerSeat2.Position)
	GunnerSeat2:Sit(Humanoid)
	Humanoid.Sit = false  

end
gosit()
end)

Found that local script vs server script doesn’t seem to matter … left using server script as fire remote event seemed useful as 2 button presses seems to possibly move or position player to touch seat and activate it

Found had to add Humanoid.Sit = false again at the end …maybe it is needed to cause a movement … found this to speed up the process … 2 button presses sometimes gets it to work … guessing seat cooldown time? essentially got it to point of sit in seat but it wouldn’t activate scripts … so you “stand up” at end and then the ‘real seat’ seems to take over like you walked into it … 2 separate scripts using wasd controls that activate or are supposed to when you sit… seems simple but this is as close and fast I could get it to almost work …

give up? last possible idea is to ditch the onseated trigger n just have player sit then have a button that enables/disables scripts … really hope this helps others cuz it’s pretty good puzzle to crack … solution is to not use it?