# Humanoid

### Humanoid

All Humanoid functions operate on the local player's humanoid automatically. You do not need to pass any instance — the functions resolve the humanoid internally.

`Humanoid.WalkSpeed()`: Returns the local player's current walk speed.

```lua
print(Humanoid.WalkSpeed())
```

`Humanoid.SetWalkSpeed(value)`: Sets the local player's walk speed.

```lua
Humanoid.SetWalkSpeed(50)
```

`Humanoid.JumpPower()`: Returns the local player's current jump power.

```lua
print(Humanoid.JumpPower())
```

`Humanoid.SetJumpPower(value)`: Sets the local player's jump power.

```lua
Humanoid.SetJumpPower(100)
```

`Humanoid.JumpHeight()`: Returns the local player's current jump height.

```lua
print(Humanoid.JumpHeight())
```

`Humanoid.SetJumpHeight(value)`: Sets the local player's jump height.

```lua
Humanoid.SetJumpHeight(10)
```

`Humanoid.Health()`: Returns the local player's current health.

```lua
print(Humanoid.Health())
```

`Humanoid.MaxHealth()`: Returns the local player's maximum health.

```lua
print(Humanoid.MaxHealth())
```

`Humanoid.MoveDirection()`: Returns the local player's current movement direction as a `Vector3`. This is a normalized vector indicating which way the character is walking.

```lua
local dir = Humanoid.MoveDirection()
print(dir.x, dir.y, dir.z)
```

`Humanoid.MoveTo(Vector3, timeout)`: Commands the humanoid to walk to a world position. `timeout` is the maximum number of seconds to attempt the movement before giving up.

```lua
Humanoid.MoveTo(Vector3(100, 0, 100), 10)
```

`Humanoid.MoveToInstance(instance, timeout)`: Commands the humanoid to walk toward an instance's position.

```lua
local target = workspace:FindFirstChild("Goal")
Humanoid.MoveToInstance(target, 10)
```

`Humanoid.StopMoveTo()`: Cancels an active `MoveTo` command immediately.

```lua
Humanoid.StopMoveTo()
```

`Humanoid.AutoRotate()`: Returns whether the humanoid automatically rotates to face its movement direction.

```lua
print(Humanoid.AutoRotate())
```

`Humanoid.SetAutoRotate(bool)`: Enables or disables automatic rotation toward the movement direction.

```lua
Humanoid.SetAutoRotate(false)
```

`Humanoid.Sit()`: Returns whether the humanoid is currently sitting.

```lua
print(Humanoid.Sit())
```

`Humanoid.SetSit(bool)`: Forces the humanoid to sit or stand.

```lua
Humanoid.SetSit(true)
```

`Humanoid.MaxSlopeAngle()`: Returns the maximum slope angle the humanoid can walk up, in degrees.

```lua
print(Humanoid.MaxSlopeAngle())
```

`Humanoid.SetMaxSlopeAngle(value)`: Sets the maximum walkable slope angle in degrees.

```lua
Humanoid.SetMaxSlopeAngle(89)
```

`Humanoid.UseJumpPower()`: Returns `true` if the humanoid uses JumpPower instead of JumpHeight.

```lua
print(Humanoid.UseJumpPower())
```

`Humanoid.SetUseJumpPower(bool)`: Switches between JumpPower and JumpHeight mode.

```lua
Humanoid.SetUseJumpPower(true)
```

`Humanoid.IsWalking()`: Returns `true` if the humanoid is currently moving.

```lua
if Humanoid.IsWalking() then
    print("player is moving")
end
```

`Humanoid.Jump()`: Makes the local player's humanoid jump immediately.

```lua
Humanoid.Jump()
```

`Humanoid.FloorMaterial()`: Returns the material enum ID of the surface the humanoid is currently standing on. Returns `0` if airborne.

```lua
local mat = Humanoid.FloorMaterial()
print(mat)
```

`Humanoid.HumanoidState()`: Returns the current humanoid state as a numeric enum ID. For example, `2` is Running, `5` is Jumping, `8` is Freefall.

```lua
local state = Humanoid.HumanoidState()
print(state)
```

`Humanoid.RootPart()`: Returns the HumanoidRootPart instance of the local player's character.

```lua
local hrp = Humanoid.RootPart()
local prim = hrp:Primitive()
print(prim:Position().x)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yerba-1.gitbook.io/yerba-docs/api/humanoid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
