How can I make so each time a player joins/spawns it spawns in a seat vehicle?

I’m trying to do a game where you start with a car and you can’t exit (like the old car games, like Test Drive Unlimited for example)

I want the car to be a simple car with a Vehicle Seat instead of a scripting a custom car.

The problem is that I can’t make the player sits on the car when the player spawns.

I tried to make the player when spawns, the car spawns and he teleports to it, but I can’t make it to sit when is teleported, there’s a way to force sitting?

Script that I made:

game.Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function(char)
		
		task.wait(2)
		
		local car = game.ReplicatedStorage.Car:Clone()
		car.Parent = workspace
		car.VehicleSeat.Anchored = true
		
		task.wait(1)
		
		char.Humanoid.JumpHeight = 0
		char.HumanoidRootPart.CFrame = car.VehicleSeat.CFrame + Vector3.new(0,4,0)
		char.Humanoid.Sit = true
		
		task.wait(2)
		
		car.VehicleSeat.Anchored = false
		
	end)
	
end)
1 Like

You can use VehicleSeat:Sit(humanoid : Humanoid)

local seat = workspace.VehicleSeat
function playerJoined(plr)
   function characterAdded(char)
     local humanoid =  char:FindFirstChild("Humanoid") or char:WaitForChild("Humanoid")
     if not humanoid then warn('Cant find humanoid for char named '..char.Name) end
     seat:Sit(humanoid)
   end
   plr.CharacterAdded:Connect(characterAdded)
end
game.Players.PlayerAdded:Connect(plrJoined)
1 Like

Thanks, it worked! :smiley: :smiley: (putting emoji bcs char limit)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.