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 .. "!")
	else
		print("I'm not sitting on anything")
	end
end
humanoid.Seated:Connect(onSeated)

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

https://developer.roblox.com/en-us/api-reference/event/Humanoid/Seated

1 Like

Oh thanks it works!

30chaarrs

1 Like