Hi! Im wondering how you can make a script that can check the local humanoid if he is seated. And after that, I want to have another line that prints "hi it worked" only if the local player is seated. I'm not gone dislike and comments unless it's just trolling. Any ideas are helpful for me so please feel free to at least try to find a solution. Thank you so much.
How to check local humanoid if seated?
1 answer
Humanoid is a object placed in every character model. Your character model is in workspace, where all the world objects appear.
-- this is a script to access it:
function humanoid(param)
if param:IsA("Model") and param.Humanoid then return param end
end
hum = workspace.ChildAdded:Connect(humanoid)
Player is the client. You use this instance when you simply want to do things on the client side like how your character is on the server.
localp = game.Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
gui = localp.PlayerGui.ScreenGui.Frame
-- your gui goes there ^
-- now
if hum.Sit and hum:GetState() == 13 then
gui.Visible = false
else
gui.Visible = true
end
That is the script... Now you may want to do this too, but your choice.
hum:GetPropertyChangedSignal("Sit"):Connect(function(change)
if change then
gui.Visible = false
else
gui.Visible = true
end
end)
8 comments
WaitForChild("LocalPlayer",4.5) LocalPlayer is a property, not an object. IsAncestorOf takes an object, not a string value. GetChangedPropertySignal is an event, which fires when a value changes, so Connect is needed. There's no enum value by the name of Enum.HumanoidStateType.13; did you mean Hum:GetState() == 13?
Thank you. What he said ^
Might I suggest covering the StateChanged and CharacterAdded events in your solution? https://developer.roblox.com/api-reference/event/Humanoid/StateChanged https://developer.roblox.com/api-reference/event/Player/CharacterAdded
Absolutely!
I want to show him the inner workings of workspace:CharAdded to give him some learning space!
I actually wouldn't recommend the workspace.ChildAdded event as it will execute that if statement every time something is added to the Workspace. This is just inefficient and unnecessary since you're given the CharacterAdded and StateChange events.
Hey Robloxian_Hero1234 Thank you so mutch for the awsners. But i quite don't understand what you mean. Would you like to chat/talk on discord? Thanks.
After the humanoid has been achieved it should disconnect good point and disc: Matheusx#3245
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
There is no "local humanoid" only humanoid