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

why is print statement not firing when humanoid.sit is true?

this is the code its a script running on the server

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
	print("ok")
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character.Humanoid
		print("ok")
		if Humanoid.Sit == true then
			print("ok")
		else
			print("NO!")
		end
	end)
end)

everything is working fine expect the third print which just doesnt print at all even if humanoid.sit is ture

1 answer

local Players,main=game:GetService"Players",function(player,char,hum)
	
	print(hum.Sit and "ok" or "NO!")
	
end


local function onCharacterAdded(char)
	local hum,player=char.Changed:Wait()and char.Humanoid,Players:GetPlayerFromCharacter(char)
	hum:GetPropertyChangedSignal"Sit":Connect(function()
		main(player,char,hum)
	end)
	main(player,char,hum)
end
local function onPlayerAdded(player)
	print("ok")
	player.CharacterAdded:Connect(onCharacterAdded)
	local char=player.Character
	if char then onCharacterAdded(char)end
end;Players.PlayerAdded:Connect(onPlayerAdded)
for _,v in ipairs(Players:GetPlayers())do
	onPlayerAdded(v)
end

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