Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do make a script detect when [player] is sitting?

I want to make a script that puts my camera on a certain part when sitting (for a vehicle) but don't know how to type it out / execute it.

1 answer

✓ Accepted answer

You can use the humanoid's Seated property

Put the following code in a LocalScript inside Explorer Tab->StarterPlayer->StarterPlayerScripts.

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
 
--this is an event that is called every time the player's Seated property changes
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)

1 comment

0

thanks man very appreciated

This discussion is preserved as it was. New answers, comments, and votes are closed.