Humanoid.Sit not working

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a check that detects when someone sits
  2. What is the issue? Include screenshots / videos if possible!
    It was working for a while, but suddenly stopped
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I found nobody else with the issue
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
while task.wait(0.1) do
if hum.Sit == true then
	print("sitting")
end
end
if hum.Sit == true then
	print("sitting")
end

try changing to

if hum.SeatPart ~= nil then
	print("sitting")
end

I still get the same issue, where it doesnt print

is this a local or server script

It is a local script in starter player scripts

it might be that you are on the client and not the server, try switching to serverscript and making the code this:

game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
while task.wait(0.1) do
if hum.Sit == true then
	print("sitting")
end
end
end)
1 Like

Try using hum.Sit.Value instead, let me know if that works.

1 Like

Both of those didnt work. Its weird, because it was working for a while and suddenly stopped

1 Like

Why not just do this?

--// Local script

local Player = game:GetService('Players').LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid') ::Humanoid

local function ValueChanged()
   if Humanoid.Sit then
      print('sitting')
   end
end

Humanoid:GetPropertyChangedSignal('Sit'):Connect(ValueChanged)
2 Likes

Great idea that should work much better.

1 Like

i think my game is bugged that didnt work either. Il try to upload a video of it later

Where did you put the local script?

Whats the actual goal besides just detect if they sit? Why do you need to detect it? Just asking incase it needs to be local or server or a different method of detecting if they’re sitting, OnSeated event or PropertyChangedSignal

1 Like

Im using it as part of a plane system, so the local script doesnt transmit the mouse position to the server while the player isnt sitting

the script is in starter player scripts

I ran the script you posted originally, it seems to work.

If it still doesn’t work for you I’d try this:

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid", 5)

hum:GetPropertyChangedSignal("Sit"):Connect(function()
	if hum.Sit == true then
		print("sitting")-- your code here if player is sitting
	else
		print("not sitting")-- your code here if player is not sitting
	end
end)

my sit detection code

local players = game:GetService("Players")

local player = players.LocalPlayer or players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")

local function onSeated(onSeat, seatPart)
	if onSeat and seatPart then
		print("sit action")
	else
		print("NO! >:( please go sit again and relax for the day")
	end
end

humanoid.Seated:Connect(onSeated)

This is what happens with all the scripts

Anyone got an idea of what could be causing this?