Humanoid

Makes a model walk, jump, and take damage.

A Humanoid sits inside a character model next to the parts that make up its body. It reads movement input, moves the character, and reports when the character dies.

Properties

Property Type What it does
WalkSpeed number Movement speed in studs per second.
JumpPower number Stored, but the jump arc uses a fixed jump height, so changing this does not change a jump.
Health number Current health.
MaxHealth number The value the health bar is drawn against. Replicated health is capped to it.
BreakJointsOnDeath boolean What the body does on death. With the default true, the body parts separate and fall with physics. With false, the body stays assembled and falls over as one piece.
AutoRotate boolean Whether the character turns to face the direction it moves.

None of these values are clamped, so setting Health above MaxHealth or giving WalkSpeed a negative number just stores whatever you set.

The engine sets Health to 0 when the character's root falls below y = -25 world units, which is about -100 studs. That kill plane is how falling out of the map ends a life.

A dead character topples to the ground. With BreakJointsOnDeath on, the body parts separate as they fall and stay where they land until the respawn replaces the character. With it off, the body keeps its shape the whole way down.

Events

Event Callback arguments When it fires
Died none Health reached 0.
StateChanged oldState, newState The character moved between its states.

The two arguments are state names. The engine passes one of these six:

State When the character is in it
Standing Grounded and not moving.
Running Grounded and moving.
Jumping Rising from a jump.
Freefall In the air and not rising.
KnockedBack Knocked over, before it stands again.
Dead Health reached 0.

There is no State property to read, so keep the last value from StateChanged if you need to know it later.

Members

Humanoid has no methods of its own. It also has the shared Instance members; see Instance.

Example

local Players = game:GetService("Players")

local function giveSpeed(player, character)
    local humanoid = character and character:FindFirstChildOfClass("Humanoid")
    if not humanoid then
        return
    end

    humanoid.WalkSpeed = 24
    humanoid.Died:Connect(function ()
        print(player.Name, "died")
    end)
end

Players.PlayerAdded:Connect(function (player)
    player.Changed:Connect(function (property)
        if property == "Character" then
            giveSpeed(player, player.Character)
        end
    end)

    giveSpeed(player, player.Character)
end)

Player has no CharacterAdded event. The character arrives as a change to Player.Character, which is what the example listens for.

See also