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
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)
good explanation how to properly script this can be found here https://developer.roblox.com/en-us/api-reference/event/Humanoid/StateChanged