Humanoid

Humanoid : Instance

Overview

Humanoid appears to be a humanoid character model in a game engine

Description

Humanoid class represent a humanoid character or model within the game environment with various properties and methods for controlling movement, animation, health management, and more. These include jump settings, control options for movement and animations, blend spaces handling, display names, camera offsets, and visual elements.

Properties

AutoJumpEnabled

bool

AutoJumpEnabled allows for enabling or disabling automatic jumping functionality in humanoid characters.

Code Samples

AutoRotate

bool

AutoRotate is used for controlling the auto-rotation behavior of the humanoid.

Code Samples

AutomaticScalingEnabled

bool

AutomaticScalingEnabled property is a boolean flag used to manage the automatic scaling of objects, adjusting sizes.

Code Samples

BreakJointsOnDeath

bool

{Description Slot}

Code Samples

CameraOffset

Vector3

The CameraOffset property is a vector3, used to adjust the camera's position.

Code Samples

DisplayDistanceType

Enum.HumanoidDisplayDistanceType

DisplayDistanceType defines an enum type that specifies the behavior for displaying a Humanoid's name and health information based

Code Samples

DisplayName

string

DisplayName is represented as an String type and displays a custom name above the head of the humanoid character in-game

Code Samples

//NotWork//

EvaluateStateMachine

bool

{Description Slot}

Code Samples

Health

number

Health represents the current health of the character and can be affected by damage, healing, or regeneration.

Code Samples

humanoid.Health = 0

HealthDisplayDistance

number

HealthDisplayDistance property determines the distance at which a character's health indicator is visible above their head.

Code Samples

HipHeight

number

HipHeight is height of a character's hips (or pelvis) relative to the ground plane.

Code Samples

Jump

bool

It represents the state of whether the character attached to this component perform a jump

Code Samples

JumpHeight

number

JumpHeight represent the maximum height a character can jump within a world.

Code Samples

//NotWork//

JumpPower

number

JumpPower property is a number value used to control the power of a humanoid character's jump.

Code Samples

humanoid.JumpPower = 0

MaxHealth

number

MaxHealth represent the maximum health value for humanoid character.

Code Samples

print(humanoid.MaxHealth)

MaxSlopeAngle

number

"MaxSlopeAngle"is used to specify the maximum angle at which an character can walk uphill.

Code Samples

MoveDirection

Vector3

MoveDirection property represents the direction of movement for an character within a world.

Code Samples

//NotWork//

NameDisplayDistance

number

{Description Slot}

Code Samples

PlatformStand

bool

"PlatformStand" indicates whether the humanoid character should stand on a platform or not.

Code Samples

RequiresNeck

bool

{Description Slot}

Code Samples

Sit

bool

Sit property is often a boolean variable that indicates whether a humanoid character sit down or stand up.

Code Samples

TargetPoint

Vector3

{Description Slot}

Code Samples

UseJumpPower

bool

{Description Slot}

Code Samples

WalkSpeed

number

WalkSpeed is primarily associated with the movement speed of a humanoid character or avatar in world.

Code Samples

humanoid.WalkSpeed = 4000

WalkToPoint

Vector3

WalkToPoint represents a target point for humanoid characters to walk towards, allowing developers and players to control their movement direction during gameplay.

Code Samples

LookCameraDirection

bool

LookCameraDirection represent whether the camera should follow the direction the humanoid character faces during gameplay.

Code Samples

Methods

AddAccessory

The AddAccessory method adds accessory instance that came in as parameters.

Parameters

Instance InAccessory

Return

void

Code Samples

ApplyDescription

{Description Slot}

Parameters

HumanoidDescription InDescription

Enum.AssetTypeVerification InAssetTypeVerification

Return

void

Code Samples

humanoid:ApplyDescription(humanoidDescription, Enum.AssetTypeVerification.Default)

ApplyDescriptionReset

{Description Slot}

Parameters

HumanoidDescription InDescription

Enum.AssetTypeVerification InAssetTypeVerification

Return

void

Code Samples

EquipTool

EquipTool is equipped with a tool instance that has been entered.

Parameters

Instance InTool

Return

void

Code Samples

humanoid:EquipTool(Tool)

GetAccessories

{Description Slot}

Parameters

Return

Tuple

Code Samples

GetAppliedDescription

{Description Slot}

Parameters

Return

HumanoidDescription

Code Samples

UnequipTools

The UnquipTools method unequip the tool currently equipped with the humanoid character.

Parameters

Return

void

Code Samples

humanoid:UnequipTools(tool)

RemoveAccessories

How to remove accessories removes accessories from humanoid characters.

Parameters

Return

void

Code Samples

LuaTakeDamage

LuaTakeDamage reduces the health of the humanoid character by parameter value.

Parameters

number InDamage

Return

void

Code Samples

humanoid:TakeDamage(100)

LoadAnimation

The LoadAnimation method is used to load an animation onto a humanoid character. It allows you to specify the animation you want to use and returns the corresponding AnimationTrack object that can be played, stopped, and manipulated as needed.

Parameters

Animation InAnimation

Return

AnimationTrack

Code Samples

local AnimationTrack = Animator:LoadAnimation(Animation)

ChangeState

ChangeState method changes the status of the humanoid character with the status value entered.

Parameters

Value InLuaValue

Return

void

Code Samples

SetStateEnabled

The SetStateEnabled method is used to enable or disable a specific humanoid state type for a character. By specifying the state type and a boolean value, the method controls whether the state is active or not.

Parameters

Enum.HumanoidStateType InHumanoidStateType

Value InEnabled

Return

void

Code Samples

GetState

{Description Slot}

Parameters

Return

Value

Code Samples

Events

ApplyDescriptionFinished

The ApplyDescriptionFinished event occurs when the application of a humanoid description to a character is completed.

Parameters

Code Samples

-- Connect the ApplyDescriptionFinished event to a function
Humanoid.ApplyDescriptionFinished:Connect(function()
    print("Description applied successfully!")
end)

Climbing

The Climbing event is triggered when the humanoid character starts climbing. This event can be used to detect or handle behaviors specific to the climbing state.

Parameters

Code Samples

-- Example: Connect the Climbing event to a function
Humanoid.Climbing:Connect(function(speed)
print("The humanoid is climbing with speed:", speed)
end)

ClusterCompositionFinished

The ClusterCompositionFinished event is triggered when the humanoid's cluster composition process is completed. This event can be used to perform actions or logic after the humanoid's composition is finalized.

Parameters

Code Samples

Died

The Died event is triggered when the humanoid character's health reaches zero, indicating that the character has died. This event can be used to handle logic related to the character's death, such as respawning, recording statistics, or triggering animations.

Parameters

Code Samples

local function OnDied()
    print("Die!")
end
humanoid.Died:Connect(OnDied)

EmoteTriggered

The EmoteTriggered event is triggered when a humanoid character plays an emote animation. This event can be used to perform actions or trigger logic whenever a player activates an emote.

Parameters

Code Samples

//NotWork//

FallingDown

The FallingDown event is triggered when the humanoid character falls down. This event can be used to handle logic or execute specific actions whenever the humanoid loses balance or falls to the ground.

Parameters

Code Samples

FreeFalling

The FreeFalling event is triggered when the humanoid character enters the FreeFalling state. This state typically occurs when the humanoid is in free fall, such as dropping from a height without any other active motion states. The event can be utilized to handle logic or actions associated with free falling, such as playing a free fall animation, enabling specific effects, or implementing mechanics related to falling.

Parameters

Code Samples

local function OnFreeFalling()
    print("OnFreeFalling!")
end		
humanoid.FreeFalling:Connect(OnFreeFalling)

GettingUp

The GettingUp event is triggered when the humanoid character transitions into the "GettingUp" state. This state generally occurs after the humanoid has fallen or entered a similar state that requires recovery. This event can be used to execute logic or trigger actions, such as playing a "getting up" animation, resetting character properties, or modifying gameplay behaviors associated with recovery.

Parameters

Code Samples

Humanoid.GettingUp:Connect(function()
    print("The humanoid is getting up!")
end)

HealthChanged

The HealthChanged event is triggered whenever there is a change in the humanoid character's health. This event can be used to perform actions or logic related to health modifications, such as updating health bars, triggering warnings, or applying specific game mechanics connected to health changes.

Parameters

Code Samples

local function OnHealthChanged()
    print("HealthChanged!")
end		
humanoid.HealthChanged:Connect(OnHealthChanged)

Jumping

The Jumping event is triggered when the humanoid character starts jumping. This event can be used to handle actions or logic associated with the jumping action, such as triggering animations, modifying physics-related parameters, or implementing custom game mechanics.

Parameters

Code Samples

local function OnJumping()
    print("Jumping!")
end		
humanoid.Jumping:Connect(OnJumping)

MoveToFinished

The MoveToFinished event in the humanoid object is triggered when the character completes a move action initiated by the MoveTo function or similar movement scripting commands. This event can help determine the success or interruption of a movement action, allowing you to handle post-move logic such as triggering animations, setting new movement targets, or logging movement results.

The MoveToFinished event is often used in scenarios where the game logic depends on whether a character reaches a specific location. For example:

  • Check if the character successfully navigated to a target destination.

  • Detect if the movement was interrupted or canceled.

  • Execute specific game mechanics upon completing the movement (e.g., dialogue triggers, animation changes).

Note: Always ensure the humanoid is properly configured and no unrelated constraints prevent the movement.

Parameters

Code Samples

//NotWork//

PlatformStanding

The PlatformStanding event is triggered when a humanoid character transitions into the "PlatformStanding" state. This state generally occurs when the character is standing stationary on a moving platform. This event can be used to trigger logic or handle behaviors specific to standing on platforms, such as stabilizing animations or adjusting movement mechanics.

Parameters

Code Samples

Ragdoll

The Ragdoll event is triggered when the humanoid character enters the "Ragdoll" state. This state generally occurs when the humanoid falls into a state of physical simulation, where its joints and limbs behave as though limp. This event can be used to trigger specific behaviors or logic related to entering the ragdoll state, such as playing a ragdoll animation or handling related game mechanics.

Parameters

Code Samples

//NotWork//

Running

The Running event is triggered when the humanoid character begins or continues moving. This event can be used to handle actions or logic associated with the humanoid's movement. For instance, you can track their running speed or trigger animations when movement starts or stops.

Parameters

Code Samples

//NotWork//

Seated

The Seated event is triggered when a humanoid character changes its seated state, such as sitting down or standing up. This event can be used to handle logic or actions associated with seating, like playing sitting animations, enabling or disabling controls, or triggering state-specific mechanics.

Parameters

Code Samples

//NotWork//

StateChanged

The StateChanged event is triggered when the humanoid character's state changes. This event can be used to monitor or handle behaviors associated with transitioning between different humanoid states, such as idle, running, or jumping.

Parameters

Code Samples

//NotWork//

StateEnabledChanged

The StateEnabledChanged event is triggered when the enabled state of a humanoid's state type changes. This event can be used to monitor or respond to changes in the humanoid's state configuration.

Parameters

Code Samples

NotWork

Strafing

The Strafing event is triggered when a humanoid character performs a strafing motion. Strafing usually refers to moving sideways without changing the character's facing direction. This event can be helpful for implementing gameplay mechanics or animations related to strafing behavior.

Parameters

Code Samples

//NotWork//

Swimming

The Swimming event is triggered when the humanoid character starts swimming. This event can be used to detect or handle behaviors specific to the swimming state.

Parameters

Code Samples

//NotWork//

Touched

The Touched event is triggered when a humanoid part comes into contact with another object or part in the game world. This event can be used to detect collisions and execute logic based on the object the humanoid interacts with.

Parameters

Code Samples

//NotWork//

Landed

The Landed event is triggered when a humanoid character lands on a surface after being in the air. This event can be used to execute logic or perform actions when the humanoid touches the ground, such as playing a landing animation, reducing health from fall damage, or resetting states.

Parameters

Code Samples

local function OnLanded()
    print("Landed!")
end		
humanoid.Landed:Connect(Landed)

ToolEquipped

The ToolEquipped event is triggered when a humanoid character equips a tool. This event can be utilized to execute specific logic or actions immediately after the tool becomes equipped, such as initializing tool functionalities, changing character properties, or triggering animations.

Parameters

Code Samples

local function OnToolEquipped()
    print("ToolEquipped!")
end		
humanoid.ToolEquipped:Connect(OnToolEquipped)

ToolUnequipped

{Description Slot}

The ToolUnequipped event is triggered when a humanoid character unequips a tool. This event can be used to handle actions that should occur when a tool is no longer in use, such as stopping animations, resetting states, or cleaning up configurations associated with the tool.

Parameters

Code Samples

local function OnToolUnequipped()
    print("ToolUnequipped!")
end		
humanoid.ToolUnequipped:Connect(OnToolUnequipped)

PlatformStandingMoving

The PlatformStandingMoving event is triggered when a humanoid character moves while standing on a platform. This event can be used to handle or trigger logic specific to the scenario where the character transitions between standing and moving states on a platform.

Parameters

Code Samples

Humanoid.PlatformStandingMoving:Connect(function()
    print("The humanoid character is moving while standing on a platform!")
end)