seat:Sit() not working

So I am creating a simple system to make the humanoid sit when clicking a part. Here is my code:

local model = script.Parent
local seatObject = model.Seat
local clickDetector = model.ClickDetector

clickDetector.MouseClick:connect(function(plr)
	seatObject:Sit(plr.Character.Humanoid)
end)

I have tried almost everything. Am I making a simple mistake?

2 Likes

Do you have any error in your output?

“Sit is not a valid member of Part”

…

Okay, your seatObject is not a Seat, it is a Part named Seat?

Try inserting a seat object through the add object menu.

It actually is a seat. Maybe this is a Studio bug?

Is the seat inside of the part?

:man_facepalming: I had another part in the workspace named Seat. Thanks for the contributions if you made any.

3 Likes

The good thing about computers is that they never lie. Make sure to always double check.

3 Likes

Make sure to use model:WaitForChild(“PartName”)

Actually you don’t need to use WaitForChild. Since the script is inside of the model, the part will always exist.

1 Like

Hmm, maybe I will make a programming language that lies to you :woozy_face:

2 Likes

Maybe but remember you are doing the lying, the computer’s only following the instructions.

1 Like

Does your Seat part have a icon like this in the explorer?
image

oof meant to reply to this

local model = script.Parent
local seatObject = model.Seat
local clickDetector = model.ClickDetector

clickDetector.MouseClick:connect(function(plr)
seatObject:Sit(plr.Parent.Humanoid)
end)

If a player joins, he or she will be classified as players. So the function you are using searches for Humanoid in Players. It’s not there. You have to find the player in workspace to find Humanoid. Try this script.

game.Players.PlayerAdded:Connect(function(plr)
	wait(5)
	if game.Workspace:FindFirstChild(plr.Name) then
		script.Parent:Sit(game.Workspace[plr.Name].Humanoid)
	end
end)