:Sit() Player not being found!

I want to make the player sit after clicking on this ui in the train that is spawned!

The issue is that the player isn’t being found!

I have tried looking on the devforum and developer section butI couldn’t find a solution


local Enabled = false

script.Parent.MouseButton1Click:Connect(function(plr)
	if Enabled == false then 
		Enabled = true
		local Mod = game.ServerStorage['90']
		if workspace.DepotSpot2.Occupied.Value == false then
			local clone = Mod:Clone()
			clone.Parent = workspace.ActiveTrains
			clone:MakeJoints()
			
			local player = plr.Parent.Parent.Parent.Parent
			
			clone:WaitForChild("Coach1").Drive:Sit(player.Character.Humanoid)
			wait(25)
			Enabled = false
		elseif workspace.DepotSpot2.Occupied.Value == true then
			script.Parent.Text = "Occupied"
			wait(1)
			script.Parent.Text = "Class 90"
		end
		
	end
	
end)

– This is in a normal script!

You can make a character sit by locating their humanoid and setting the sit option to true.

character.Humanoid.Sit = true

I’m pretty sure :Sit() is only for seats

1 Like

Also, Character should always be defined by this to avoid errors. Just a heads up:

local player = game.Players.LocalPlayer -- LocalPlayer only works in local script. Server script's cant define the local player
local character = player.character or player.CharacterAdded:Wait()

also in the original script, it couldn’t find the player because you defined player as “plr” in the function.

1 Like