We use cookies on this site to enhance your user experience

Finding a Player's Seat

Finding a Player's Seat

Sep 07 2018, 2:22 AM PST

The code below fires when the Players/LocalPlayer|LocalPlayer's Player/Character|Character sits down or stands up.

It should be placed inside a LocalScript parented to StarterPlayerScripts|StarterPlayer.StarterPlayerScripts.

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

humanoid.Seated:Connect(function(isSeated, seat)
	if isSeated then
		if seat then
			print ("The player is now sitting in the seat named "..seat.Name.."!")
		end
	else
		print("The player is no longer sitting!")
	end
end)