Humanoidクラス
ひとことで言うと
キャラクターの「体の動き」と「体力」を管理するクラスです。歩く速さ・ジャンプ・体力・やられたときのイベントなどを扱います。
公式の説明(英語):A special object that gives models the functionality of a character.
使用例
local part = script.Parent :: BasePart
part.Touched:Connect(function(hit)
local character = hit.Parent
if not character then
return
end
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
humanoid.Health = 0
end
end)local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid") :: Humanoid
humanoid.WalkSpeed = 32
end)
end)スクリプトは、Luauの型チェック(luau-lsp)で確認しています。
クラスの関係
プロパティ(32)
| 名前と書き方 | 説明 |
|---|---|
AutoJumpEnabledHumanoid.AutoJumpEnabled: boolean | Sets whether the character will automatically jump when they hit an obstacle as a player on a mobile device. |
AutomaticScalingEnabledHumanoid.AutomaticScalingEnabled: boolean | When Enabled, AutomaticScalingEnabled causes the size of the character to change in response to the values in the humanoid's child scale values changing. |
AutoRotateHumanoid.AutoRotate: boolean | AutoRotate sets whether or not the Humanoid will automatically rotate to face in the direction they are moving in. |
BreakJointsOnDeathHumanoid.BreakJointsOnDeath: boolean | Determines whether the humanoid's joints break when in the HumanoidStateType.Dead state. |
CameraOffsetHumanoid.CameraOffset: Vector3 | An offset applied to the Camera's subject position when its CameraSubject is set to this Humanoid. |
DisplayDistanceTypeHumanoid.DisplayDistanceType: HumanoidDisplayDistanceType | Controls the distance behavior of the humanoid's name and health display. |
DisplayNameHumanoid.DisplayName: string | Sets the text of a Humanoid, displayed above their head. |
EvaluateStateMachineHumanoid.EvaluateStateMachine: boolean | Used to disable the internal physics and state machine of the Humanoid. |
FloorMaterialHumanoid.FloorMaterial: Material | Describes the Material that the Humanoid is currently standing on. If the Humanoid isn't standing on anything, the value of this property will be _Air_. |
HealthHumanoid.Health: float | 今の体力。0になると、キャラクターがやられます。Describes the current health of the Humanoid on the range [0, Humanoid.MaxHealth]. |
HealthDisplayDistanceHumanoid.HealthDisplayDistance: float | Used in conjunction with the Class.Humanoid.DisplayDistanceType|DisplayDistanceType property to control the distance from which a humanoid's health bar can be seen. |
HealthDisplayTypeHumanoid.HealthDisplayType: HumanoidHealthDisplayType | Controls when the humanoid's health bar is allowed to be displayed. |
HipHeightHumanoid.HipHeight: float | Determines the distance off the ground the Humanoid.RootPart should be. |
JumpHumanoid.Jump: boolean | If true, the Humanoid jumps with an upwards force. |
JumpHeightHumanoid.JumpHeight: float | ジャンプの高さ(UseJumpPowerがfalseのとき)。Provides control over the height that the Humanoid jumps to. |
JumpPowerHumanoid.JumpPower: float | ジャンプの強さ(UseJumpPowerがtrueのとき)。Determines how much upwards force is applied to the Humanoid when jumping. |
MaxHealthHumanoid.MaxHealth: float | 体力の最大値。初期値は100です。The maximum value of a humanoid's Class.Humanoid.Health|Health. |
MaxSlopeAngleHumanoid.MaxSlopeAngle: float | The maximum slope angle that a humanoid can walk on without slipping. |
MoveDirectionHumanoid.MoveDirection: Vector3 | Describes the direction that the Humanoid is walking in. |
NameDisplayDistanceHumanoid.NameDisplayDistance: float | Used in conjunction with the Humanoid.DisplayDistanceType property to control the distance from which a humanoid's name can be seen. |
NameOcclusionHumanoid.NameOcclusion: NameOcclusion | Controls whether a humanoid's name and health bar can be seen behind walls or other objects. |
PlatformStandHumanoid.PlatformStand: boolean | Determines whether the Humanoid is currently in the HumanoidStateType.PlatformStanding state. |
RequiresNeckHumanoid.RequiresNeck: boolean | Allows developers to disable the behavior where a player Character|character dies if the Neck Motor6D is removed or disconnected even momentarily. |
RigTypeHumanoid.RigType: HumanoidRigType | Describes whether this Humanoid is utilizing the legacy R6 character rig, or the new R15 character rig. |
RootPartHumanoid.RootPart: BasePart | A reference to the humanoid's HumanoidRootPart object. |
SeatPartHumanoid.SeatPart: BasePart | A reference to the seat that a Humanoid is currently sitting in, if any. |
SitHumanoid.Sit: boolean | Describes whether the Humanoid is currently sitting. |
TargetPointHumanoid.TargetPoint: Vector3 | Describes the 3D position where the Player controlling the Humanoid last clicked in the world while using a Tool. |
UseJumpPowerHumanoid.UseJumpPower: boolean | Determines whether the Class.Humanoid.JumpHeight|JumpHeight (false) or Humanoid.JumpPower (true) property is used. |
WalkSpeedHumanoid.WalkSpeed: float | 歩く速さ。初期値は16です。Describes the humanoid's maximum movement speed in studs per second. |
WalkToPartHumanoid.WalkToPart: BasePart | A reference to a part whose position is trying to be reached by a humanoid. |
WalkToPointHumanoid.WalkToPoint: Vector3 | The position that a humanoid is trying to reach, after a call to Class.Humanoid:MoveTo() is made. |
メソッド(22)
| 名前と書き方 | 説明 |
|---|---|
AddAccessoryHumanoid:AddAccessory(accessory: Instance): () | Attaches the specified Accessory to the humanoid's parent. |
ApplyDescriptionAsyncHumanoid:ApplyDescriptionAsync(humanoidDescription: HumanoidDescription, assetTypeVerification: AssetTypeVerification): () | Makes the character's look match that of the passed in HumanoidDescription. If HumanoidDescription.UseAvatarSettings is true, the Avatar Settings for the experience will also be applied to the character. |
ApplyDescriptionResetAsyncHumanoid:ApplyDescriptionResetAsync(humanoidDescription: HumanoidDescription, assetTypeVerification: AssetTypeVerification): () | Makes the character's look match that of the passed in HumanoidDescription, even after external changes. |
BuildRigFromAttachmentsHumanoid:BuildRigFromAttachments(): () | Assembles a tree of Motor6D joints by attaching together Attachment objects in a humanoid's character. |
ChangeStateHumanoid:ChangeState(state: HumanoidStateType): () | Sets the Humanoid to enter the given HumanoidStateType. |
EquipToolHumanoid:EquipTool(tool: Instance): () | Makes the Humanoid equip the given Tool. |
GetAccessoriesHumanoid:GetAccessories(): Array | Returns an array of Accessory objects that the humanoid's parent is currently wearing. |
GetAppliedDescriptionHumanoid:GetAppliedDescription(): HumanoidDescription | Returns a copy of the humanoid's cached HumanoidDescription which describes its current look. |
GetBodyPartR15Humanoid:GetBodyPartR15(part: Instance): BodyPartR15 | Pass a body part to this method (the body part should be a sibling of Humanoid, and a child of a Model) to get the BodyPartR15 of the Part. |
GetLimbHumanoid:GetLimb(part: Instance): Limb | Returns the Limb enum that is associated with the given Part. |
GetMoveVelocityHumanoid:GetMoveVelocity(): Vector3 | Returns the current intended movement velocity of the Humanoid. |
GetRelativeVelocityAtFloorHumanoid:GetRelativeVelocityAtFloor(): Vector3 | Returns the humanoid's actual physical velocity relative to the surface it is standing on as a Vector3 in world-space orientation. |
GetStateHumanoid:GetState(): HumanoidStateType | Returns the humanoid's current HumanoidStateType. |
GetStateEnabledHumanoid:GetStateEnabled(state: HumanoidStateType): boolean | Returns whether a HumanoidStateType is enabled for the Humanoid. |
MoveHumanoid:Move(moveDirection: Vector3, relativeToCamera: boolean): () | Causes the Humanoid to walk in the given direction. |
MoveToHumanoid:MoveTo(location: Vector3, part: Instance): () | 指定した場所へ歩いて移動させます。Causes the Humanoid to attempt to walk to the given location by setting the Humanoid.WalkToPoint and Humanoid.WalkToPart properties. |
PlayEmoteAsyncHumanoid:PlayEmoteAsync(emoteName: string): boolean | Plays emotes and returns if was successfully ran. |
RemoveAccessoriesHumanoid:RemoveAccessories(): () | Removes all Accessory objects worn by the humanoid's parent. |
ReplaceBodyPartR15Humanoid:ReplaceBodyPartR15(bodyPart: BodyPartR15, part: BasePart): boolean | Dynamically replaces a Humanoid body part with a different part. |
SetStateEnabledHumanoid:SetStateEnabled(state: HumanoidStateType, enabled: boolean): () | Sets whether a given HumanoidStateType is enabled for the Humanoid. |
TakeDamageHumanoid:TakeDamage(amount: float): () | 体力を減らします(バリアなどで守られているときは減りません)。Lowers the Humanoid.Health of the Humanoid by the given _amount_ if it is not protected by a ForceField. |
UnequipToolsHumanoid:UnequipTools(): () | Unequips any Tool currently equipped by the Humanoid. |
イベント(18)
| 名前と書き方 | 説明 |
|---|---|
ApplyDescriptionFinishedHumanoid.ApplyDescriptionFinished(description: HumanoidDescription) | Fires when a HumanoidDescription has finished being applied to the Humanoid. |
ClimbingHumanoid.Climbing(speed: float) | Fires when the speed at which a Humanoid is climbing changes. |
DiedHumanoid.Died() | キャラクターがやられたときに発生するイベントです。Fires when the Humanoid dies. |
FallingDownHumanoid.FallingDown(active: boolean) | Fires when the Humanoid enters or leaves the FallingDown HumanoidStateType. |
FreeFallingHumanoid.FreeFalling(active: boolean) | Fires when the Humanoid enters or leaves the Freefall HumanoidStateType. |
GettingUpHumanoid.GettingUp(active: boolean) | Fires when the Humanoid enters or leaves the GettingUp HumanoidStateType. |
HealthChangedHumanoid.HealthChanged(health: float) | 体力が変わったときに発生するイベントです。Fires when the Humanoid.Health changes (or when the Humanoid.MaxHealth is set). |
JumpingHumanoid.Jumping(active: boolean) | Fires when the Humanoid enters and leaves the Jumping HumanoidStateType. |
MoveToFinishedHumanoid.MoveToFinished(reached: boolean) | Fires when the Humanoid finishes walking to a goal declared by Class.Humanoid:MoveTo(). |
PlatformStandingHumanoid.PlatformStanding(active: boolean) | Fires when the Humanoid enters or leaves the PlatformStanding HumanoidStateType. |
RagdollHumanoid.Ragdoll(active: boolean) | Fires when the Humanoid enters or leaves the Ragdoll HumanoidStateType. |
RunningHumanoid.Running(speed: float) | Fires when the speed at which a Humanoid is running changes. |
SeatedHumanoid.Seated(active: boolean, currentSeatPart: BasePart) | Fired when a Humanoid either sits in a Seat or VehicleSeat or gets up. |
StateChangedHumanoid.StateChanged(old: HumanoidStateType, new: HumanoidStateType) | Fires when the state of the Humanoid is changed. |
StateEnabledChangedHumanoid.StateEnabledChanged(state: HumanoidStateType, isEnabled: boolean) | Fires when Class.Humanoid:SetStateEnabled() is called on the Humanoid. |
StrafingHumanoid.Strafing(active: boolean) | Fires when the Humanoid enters or leaves the StrafingNoPhysics HumanoidStateType. |
SwimmingHumanoid.Swimming(speed: float) | Fires when the speed at which a Humanoid is swimming in Terrain water changes. |
TouchedHumanoid.Touched(touchingPart: BasePart, humanoidPart: BasePart) | Fires when one of the humanoid's limbs come in contact with another BasePart. |
受け継いでいるメンバー
Instance から受け継いでいるもの(46)
Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged
Object から受け継いでいるもの(4)
Humanoidを使う記事
英語の説明とメンバーの一覧は、Roblox Creator Documentation(Humanoid)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。