Humanoid:GetStateEnabled
The GetStateEnabled method returns whether a Enum.HumanoidStateType is enabled for the Humanoid.
The humanoid state describes the activity the humanoid is currently doing.
When a particular Enum.HumanoidStateType is disabled, the humanoid can never enter that state. This is true regardless if the attempt to change state is made using Humanoid:ChangeState() or Roblox internal humanoid code.
See also:
- For an event that fires when a humanoid state is enabled or disabled see Humanoid.StateEnabledChanged
- To enable or disable a Humanoid state use Humanoid:SetStateEnabled()
Parameters
The given Enum.HumanoidStateType.
Returns
Whether the given Enum.HumanoidStateType is enabled.
Code Samples
The code below sets the value of the humanoid jumping state to false using Humanoid:SetStateEnabled() and then retrieves and prints the value of this state (false) using Humanoid:GetStateEnabled().
Setting and Getting Humanoid States
local humanoid = script.Parent:WaitForChild("Humanoid")
-- Set state
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
-- Get state
print(humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping)) -- false