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

Sit detection local script not working?

This local script doesn't make the surface GUI children visible?

	game.Players.LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("Sit"):Connect(function()
	if game.Players.LocalPlayer.Character.Humanoid.Sit == true then
		script.Parent.Screen.SurfaceGui.ScrollingFrame.Visible = true
		script.Parent.Screen.SurfaceGui.Laptop.Visible = true
		else
		script.Parent.Screen.SurfaceGui.ScrollingFrame.Visible = false
		script.Parent.Screen.SurfaceGui.Laptop.Visible = false
		end
	end

2 comments

0

because sit isnt a property so you cant check that, you have to check the humanoid:GetState() or whatever that one is called

0

Humanoid.Sit is actually a property...

3 answers

This is my finished script ,it still doesn't work?

local isSitting = false
   game.Players.LocalPlayer.Character.Humanoid.StateChanged:Connect(function(old, new)
	if game.Players.LocalPlayer.Character.Humanoid.Sit then
	
		script.Parent.Screen.SurfaceGui.ScrollingFrame.Visible = true
		script.Parent.Screen.SurfaceGui.Laptop.Visible = true
		else
		script.Parent.Screen.SurfaceGui.ScrollingFrame.Visible = false
		script.Parent.Screen.SurfaceGui.Laptop.Visible = false
		end
	end
local plr =  game.Players.LocalPlayer
local char = plr.Character
local hum =  char:WaitForChild("Humanoid")

hum.HumanoidStateChanged:Connect(function(old, new) --Fires when a humanoid's state changes
	if hum.Sit then  --If  we're sitting...
		--code
	elseif not hum.Sit then  --If we're not...
		--code
	end
end)
		

1 comment

0

I tried that but it didn't work, my modified version of your script is below

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