Force player into vehicle

What I’m trying to do here is to make a car stunt based game and I don’t want players to leave their vehicles.

So everytime a player joins/spawns, he gets inside a car immediately.

How can I properly execute this?

local vehicleSeats = {}

for i,v in pairs(workspace:GetDescendants()) do
	
	if v:IsA("VehicleSeat") then
		
		table.insert(vehicleSeats, v)
		
	end
	
end

game.Players.PlayerAdded:Connect(function(player)
	
	local chosenVehcileSeat = vehicleSeats[math.random(1,table.getn(vehicleSeats))]
	
	workspace:WaitForChild(player.Name)
	chosenVehcileSeat:Sit(workspace[player.Name].Humanoid)
	
end)
1 Like