Make player spawn in seat?

Hmmmm… I recommend trying something like this:

local Players = game:GetService("Players")

local Chair = game.Workspace.Chair -- whatever your value is 

Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        char:MoveTo(Chair.Position)
        Chair:Sit(char.Humanoid)

I’m not sure why, but it still has the same error message, did you see i said the seat had a proximity prompt and is this script is supposed to go into serverscriptservice?

It’s not the character you’re using, it’s the player. Humanoids are not present in the player, so use the character instead

local Players = game:GetService("Players")

local Chair = game.Workspace.Chair 

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		repeat
			wait(0.5)
		until char:FindFirstChild("Humanoid")
		Chair:Sit(char:WaitForChild("Humanoid"))
	end)
end)

1 Like

Use char:WaitForChild(“Humanoid”) instead of that repeat loop

local Players = game:GetService("Players")

local Chair = game.Workspace.Chair 

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		Chair:Sit(Humanoid)
	end)
end)

The script that I made is for player joining and forced to sit at different seats, but you could also use this to force someone into one seat instead of multiple seats.

local chairFolder = game.Workspace.Chair
local Players = game.Players

--Table to hold the chair variables, and if they're taken or not.
local seatStatus = {
	{chair = chairFolder.Seat, taken = false},
	{chair = chairFolder.Seat, taken = false},
	{chair = chairFolder.Seat, taken = false},
	{chair = chairFolder.Seat, taken = false},
	{chair = chairFolder.Seat, taken = false}
}

function seatPlayers(player)
	local character = player.Character or player.CharacterAdded:Wait()
	local hum = character:FindFirstChildOfClass("Humanoid")
	hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
	if hum then
		--Looks through all seats in the table and checks if they're taken.
		for i, v in pairs(seatStatus) do
			if v.taken == false then
				wait(0.5)
				v.chair:Sit(hum)
				v.taken = true
				break
			else --If it is taken, will continue untl the end of the table, or until it finds a chair not taken,
			end
		end
	end
end

Players.PlayerAdded:Connect(seatPlayers) --Fires the seatPlayers function when a player joins the game
3 Likes

It worked, thanks. But do you know how to get rid of the proximity prompt when a player is in the seat?