How would I detect if the player sits, but in a local script?

So I need a script that detects if the player sits and gets the seat that the player is in, but the one I made doesn’t work and all of the topics online are just a script in the seat.

In character scripts use the function Humanoid.Seated

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
function onSeated(isSeated, seat)
	if isSeated then
		print("I'm now sitting on: " .. seat.Name .. "!")
		print("I'm not sitting on anything")

This code is from the api reference, check it here.

1 Like

Oh thanks it works!


1 Like