学ぶ
エンジンクラス
Humanoid

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
方法
AddAccessory(accessory: Instance):()
AddCustomStatus(status: string):boolean
非推奨
AddStatus(status: Enum.Status):boolean
非推奨
ApplyDescription(humanoidDescription: HumanoidDescription,assetTypeVerification: Enum.AssetTypeVerification):()
非推奨
ApplyDescriptionAsync(humanoidDescription: HumanoidDescription,assetTypeVerification: Enum.AssetTypeVerification):()
ApplyDescriptionReset(humanoidDescription: HumanoidDescription,assetTypeVerification: Enum.AssetTypeVerification):()
非推奨
ApplyDescriptionResetAsync(humanoidDescription: HumanoidDescription,assetTypeVerification: Enum.AssetTypeVerification):()
GetStatuses():{any}
非推奨
HasCustomStatus(status: string):boolean
非推奨
HasStatus(status: Enum.Status):boolean
非推奨
LoadAnimation(animation: Animation):AnimationTrack
非推奨
loadAnimation(animation: Animation):AnimationTrack
非推奨
Move(moveDirection: Vector3,relativeToCamera: boolean):()
MoveTo(location: Vector3,part: Instance):()
PlayEmote(emoteName: string):boolean
非推奨
RemoveCustomStatus(status: string):boolean
非推奨
RemoveStatus(status: Enum.Status):boolean
非推奨
TakeDamage(amount: number):()
takeDamage(amount: number):()
非推奨
継承されたメンバー
コードサンプル
歩きカメラバブル効果
local RunService = game:GetService("RunService")
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local function updateBobbleEffect()
local now = tick()
if humanoid.MoveDirection.Magnitude > 0 then -- キャラクターは歩いていますか?
local velocity = humanoid.RootPart.Velocity
local bobble_X = math.cos(now * 9) / 5
local bobble_Y = math.abs(math.sin(now * 12)) / 5
local bobble = Vector3.new(bobble_X, bobble_Y, 0) * math.min(1, velocity.Magnitude / humanoid.WalkSpeed)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, 0.25)
else
-- CameraOffsetを縮小して、通常の位置に戻るようにします。
humanoid.CameraOffset = humanoid.CameraOffset * 0.75
end
end
RunService.RenderStepped:Connect(updateBobbleEffect)

APIリファレンス
プロパティ
AutoJumpEnabled
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.AutoJumpEnabled:boolean
コードサンプル
オートジャンプ切り替え
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local button = script.Parent
local function update()
-- ボタンのテキストを更新
if player.AutoJumpEnabled then
button.Text = "オートジャンプはオンです"
else
button.Text = "オートジャンプはオフです"
end
-- プレイヤーのキャラクターにプロパティを反映
if player.Character then
local human = player.Character:FindFirstChild("Humanoid")
if human then
human.AutoJumpEnabled = player.AutoJumpEnabled
end
end
end
local function onActivated()
-- オートジャンプを切り替え
player.AutoJumpEnabled = not player.AutoJumpEnabled
-- その他を更新
update()
end
button.Activated:Connect(onActivated)
update()

AutomaticScalingEnabled
並列読み取り
機能: AvatarAppearance
Humanoid.AutomaticScalingEnabled:boolean

AutoRotate
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.AutoRotate:boolean
コードサンプル
オートローテートボタン
local button = script.Parent
local enabled = true
local ON_COLOR = BrickColor.Green()
local OFF_COLOR = BrickColor.Red()
local function touchButton(humanoid)
if enabled then
enabled = false
button.BrickColor = OFF_COLOR
if humanoid.AutoRotate then
print(humanoid:GetFullName() .. " はもはやオートローテートできません!")
humanoid.AutoRotate = false
else
print(humanoid:GetFullName() .. " はオートローテートできるようになりました!")
humanoid.AutoRotate = true
end
task.wait(1)
button.BrickColor = ON_COLOR
enabled = true
end
end
local function onTouched(hit)
local char = hit:FindFirstAncestorWhichIsA("Model")
if char then
local humanoid = char:FindFirstChildOfClass("Humanoid")
if humanoid then
touchButton(humanoid)
end
end
end
button.Touched:Connect(onTouched)
button.BrickColor = ON_COLOR

BreakJointsOnDeath
並列読み取り
機能: AvatarBehavior
Humanoid.BreakJointsOnDeath:boolean

CameraOffset
並列読み取り
機能: AvatarBehavior
Humanoid.CameraOffset:Vector3
コードサンプル
歩きカメラバブル効果
local RunService = game:GetService("RunService")
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local function updateBobbleEffect()
local now = tick()
if humanoid.MoveDirection.Magnitude > 0 then -- キャラクターは歩いていますか?
local velocity = humanoid.RootPart.Velocity
local bobble_X = math.cos(now * 9) / 5
local bobble_Y = math.abs(math.sin(now * 12)) / 5
local bobble = Vector3.new(bobble_X, bobble_Y, 0) * math.min(1, velocity.Magnitude / humanoid.WalkSpeed)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, 0.25)
else
-- CameraOffsetを縮小して、通常の位置に戻るようにします。
humanoid.CameraOffset = humanoid.CameraOffset * 0.75
end
end
RunService.RenderStepped:Connect(updateBobbleEffect)

CollisionType
非推奨

DisplayDistanceType
並列読み取り
機能: AvatarAppearance
Humanoid.DisplayDistanceType:Enum.HumanoidDisplayDistanceType
コードサンプル
ヒューマノイドの健康と名前を表示する
local humanoid = script.Parent
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.Viewer
humanoid.HealthDisplayDistance = 0
humanoid.NameDisplayDistance = 100

DisplayName
並列読み取り
機能: AvatarAppearance
Humanoid.DisplayName:string

EvaluateStateMachine
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.EvaluateStateMachine:boolean

FloorMaterial
読み取り専用
複製されていません
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.FloorMaterial:Enum.Material

Health
複製されていません
並列読み取り
機能: AvatarBehavior
Humanoid.Health:number

HealthDisplayDistance
並列読み取り
機能: AvatarAppearance
Humanoid.HealthDisplayDistance:number

HealthDisplayType
並列読み取り
機能: AvatarAppearance
Humanoid.HealthDisplayType:Enum.HumanoidHealthDisplayType

HipHeight
並列読み取り
機能: AvatarAppearance
シミュレーションへのアクセス
Humanoid.HipHeight:number

Jump
複製されていません
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.Jump:boolean

JumpHeight
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.JumpHeight:number

JumpPower
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.JumpPower:number

LeftLeg
非推奨

MaxHealth
並列読み取り
機能: AvatarBehavior
Humanoid.MaxHealth:number

maxHealth
非推奨

MaxSlopeAngle
並列読み取り
機能: AvatarBehavior
Humanoid.MaxSlopeAngle:number
コードサンプル
ヒューマノイドが登れる傾斜の制限
local player = game.Players.LocalPlayer
local char = player.CharacterAdded:wait()
local h = char:FindFirstChild("Humanoid")
h.MaxSlopeAngle = 30

MoveDirection
読み取り専用
複製されていません
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.MoveDirection:Vector3
コードサンプル
歩きカメラバブル効果
local RunService = game:GetService("RunService")
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local function updateBobbleEffect()
local now = tick()
if humanoid.MoveDirection.Magnitude > 0 then -- キャラクターは歩いていますか?
local velocity = humanoid.RootPart.Velocity
local bobble_X = math.cos(now * 9) / 5
local bobble_Y = math.abs(math.sin(now * 12)) / 5
local bobble = Vector3.new(bobble_X, bobble_Y, 0) * math.min(1, velocity.Magnitude / humanoid.WalkSpeed)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, 0.25)
else
-- CameraOffsetを縮小して、通常の位置に戻るようにします。
humanoid.CameraOffset = humanoid.CameraOffset * 0.75
end
end
RunService.RenderStepped:Connect(updateBobbleEffect)

NameDisplayDistance
並列読み取り
機能: AvatarAppearance
Humanoid.NameDisplayDistance:number

NameOcclusion
並列読み取り
機能: AvatarAppearance
Humanoid.NameOcclusion:Enum.NameOcclusion
コードサンプル
プレイヤー名を隠す
local Players = game:GetService("Players")
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.NamOcclusion = Enum.NameOcclusion.OccludeAll
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)

PlatformStand
並列読み取り
機能: AvatarBehavior
Humanoid.PlatformStand:boolean

RequiresNeck
並列読み取り
機能: AvatarBehavior
Humanoid.RequiresNeck:boolean

RightLeg
非推奨

RigType
並列読み取り
機能: AvatarAppearance
Humanoid.RigType:Enum.HumanoidRigType

RootPart
読み取り専用
複製されていません
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.RootPart:BasePart

SeatPart
読み取り専用
複製されていません
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.SeatPart:BasePart

Sit
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.Sit:boolean

TargetPoint
並列読み取り
機能: AvatarBehavior
Humanoid.TargetPoint:Vector3

Torso
非推奨

UseJumpPower
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.UseJumpPower:boolean

WalkSpeed
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.WalkSpeed:number

WalkToPart
並列読み取り
機能: AvatarBehavior
Humanoid.WalkToPart:BasePart

WalkToPoint
並列読み取り
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid.WalkToPoint:Vector3

方法
AddAccessory
機能: AvatarAppearance
Humanoid:AddAccessory(accessory:Instance):()
パラメータ
accessory:Instance
戻り値
()
コードサンプル
[Humanoid] AddAccessoryの例
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local clockworksShades = Instance.new("Accessory")
clockworksShades.Name = "ClockworksShades"
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(1, 1.6, 1)
handle.Parent = clockworksShades
local faceFrontAttachment = Instance.new("Attachment")
faceFrontAttachment.Name = "FaceFrontAttachment"
faceFrontAttachment.Position = Vector3.new(0, -0.24, -0.45)
faceFrontAttachment.Parent = handle
local mesh = Instance.new("SpecialMesh")
mesh.Name = "Mesh"
mesh.Scale = Vector3.new(1, 1.3, 1)
mesh.MeshId = "rbxassetid://1577360"
mesh.TextureId = "rbxassetid://1577349"
mesh.Parent = handle
humanoid:AddAccessory(clockworksShades)

AddCustomStatus
非推奨

AddStatus
非推奨

ApplyDescription
非推奨

ApplyDescriptionAsync
イールド
機能: AvatarAppearance
Humanoid:ApplyDescriptionAsync(
humanoidDescription:HumanoidDescription, assetTypeVerification:Enum.AssetTypeVerification
):()
パラメータ
humanoidDescription:HumanoidDescription
assetTypeVerification:Enum.AssetTypeVerification
既定値: "Default"
戻り値
()

ApplyDescriptionReset
非推奨

ApplyDescriptionResetAsync
イールド
機能: AvatarAppearance
Humanoid:ApplyDescriptionResetAsync(
humanoidDescription:HumanoidDescription, assetTypeVerification:Enum.AssetTypeVerification
):()
パラメータ
humanoidDescription:HumanoidDescription
assetTypeVerification:Enum.AssetTypeVerification
既定値: "Default"
戻り値
()

BuildRigFromAttachments
機能: AvatarBehavior
Humanoid:BuildRigFromAttachments():()
戻り値
()
コードサンプル
アタッチメントからのBuildRigのLuaポート
local function createJoint(jointName, att0, att1)
local partForJoint = att1.Parent
while partForJoint and not partForJoint:IsA("BasePart") do
partForJoint = partForJoint.Parent
end
local oldJoint = partForJoint:FindFirstChild(jointName)
if oldJoint and oldJoint:IsA("AnimationConstraint") then
oldJoint.Attachment0 = att0
oldJoint.Attachment1 = att1
oldJoint.Parent = partForJoint
else
local ac = Instance.new("AnimationConstraint")
ac.Name = jointName
ac.IsKinematic = true
ac.Attachment0 = att0
ac.Attachment1 = att1
ac.Parent = partForJoint
end
end
local function collectRigAttachments(part)
local rigAttachments = {}
for _, child in pairs(part:GetChildren()) do
if child:IsA("Attachment") and child.Name:find("RigAttachment$") then
rigAttachments[child.Name] = child
end
end
-- ボーンは、パートレベルの RigAttachments を上書きする
-- より深い RigAttachments を含む場合があります (R15+ 拡張スケルトン)。
for _, child in pairs(part:GetChildren()) do
if child:IsA("Bone") then
for _, descendant in pairs(child:GetDescendants()) do
if descendant:IsA("Attachment") and descendant.Name:find("RigAttachment$") then
rigAttachments[descendant.Name] = descendant
end
end
end
end
return rigAttachments
end
local function buildJointsFromAttachments(part, characterParts, visitedParts)
if not part or visitedParts[part] then
return
end
visitedParts[part] = true
local rigAttachments = collectRigAttachments(part)
for attachmentName, attachment in pairs(rigAttachments) do
local jointName = attachmentName:sub(1, #attachmentName - #"RigAttachment")
if not part:FindFirstChild(jointName) then
for _, characterPart in pairs(characterParts) do
if not visitedParts[characterPart] then
local matchingAttachment = characterPart:FindFirstChild(attachmentName)
if matchingAttachment and matchingAttachment:IsA("Attachment") then
createJoint(jointName, attachment, matchingAttachment)
buildJointsFromAttachments(characterPart, characterParts, visitedParts)
break
end
end
end
end
end
end
local function buildRigFromAttachments(humanoid)
local rootPart = humanoid.RootPart
assert(rootPart, "Humanoid に HumanoidRootPart がありません。")
local characterParts = {}
for _, descendant in ipairs(humanoid.Parent:GetDescendants()) do
if descendant:IsA("BasePart") then
table.insert(characterParts, descendant)
end
end
local visitedParts = {}
buildJointsFromAttachments(rootPart, characterParts, visitedParts)
end
local humanoid = script.Parent:WaitForChild("Humanoid")
buildRigFromAttachments(humanoid)
R15 パッケージインポーター
local AssetService = game:GetService("AssetService")
local InsertService = game:GetService("InsertService")
local MarketplaceService = game:GetService("MarketplaceService")
local PACKAGE_ASSET_ID = 193700907 -- サーキットブレーカー
local function addAttachment(part, name, position, orientation)
local attachment = Instance.new("Attachment")
attachment.Name = name
attachment.Parent = part
if position then
attachment.Position = position
end
if orientation then
attachment.Orientation = orientation
end
return attachment
end
local function createBaseCharacter()
local character = Instance.new("Model")
local humanoid = Instance.new("Humanoid")
humanoid.Parent = character
local rootPart = Instance.new("Part")
rootPart.Name = "HumanoidRootPart"
rootPart.Size = Vector3.new(2, 2, 1)
rootPart.Transparency = 1
rootPart.Parent = character
addAttachment(rootPart, "RootRigAttachment")
local head = Instance.new("Part")
head.Name = "Head"
head.Size = Vector3.new(2, 1, 1)
head.Parent = character
local headMesh = Instance.new("SpecialMesh")
headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
headMesh.MeshType = Enum.MeshType.Head
headMesh.Parent = head
local face = Instance.new("Decal")
face.Name = "face"
face.Texture = "rbxasset://textures/face.png"
face.Parent = head
addAttachment(head, "FaceCenterAttachment")
addAttachment(head, "FaceFrontAttachment", Vector3.new(0, 0, -0.6))
addAttachment(head, "HairAttachment", Vector3.new(0, 0.6, 0))
addAttachment(head, "HatAttachment", Vector3.new(0, 0.6, 0))
addAttachment(head, "NeckRigAttachment", Vector3.new(0, -0.5, 0))
return character, humanoid
end
local function createR15Package(packageAssetId)
local packageAssetInfo = MarketplaceService:GetProductInfoAsync(packageAssetId)
local character, humanoid = createBaseCharacter()
character.Name = packageAssetInfo.Name
local assetIds = AssetService:GetAssetIdsForPackageAsync(packageAssetId)
for _, assetId in pairs(assetIds) do
local limb = InsertService:LoadAsset(assetId)
local r15 = limb:FindFirstChild("R15")
if r15 then
for _, part in pairs(r15:GetChildren()) do
part.Parent = character
end
else
for _, child in pairs(limb:GetChildren()) do
child.Parent = character
end
end
end
humanoid:BuildRigFromAttachments()
return character
end
local r15Package = createR15Package(PACKAGE_ASSET_ID)
r15Package.Parent = workspace

ChangeState
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:ChangeState(state:Enum.HumanoidStateType):()
パラメータ
既定値: "None"
戻り値
()
コードサンプル
ダブルジャンプ
local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local doubleJumpEnabled = false
humanoid.StateChanged:Connect(function(_oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not doubleJumpEnabled then
task.wait(0.2)
if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
doubleJumpEnabled = true
end
end
elseif newState == Enum.HumanoidStateType.Landed then
doubleJumpEnabled = false
end
end)
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.Space then
if doubleJumpEnabled then
if humanoid:GetState() ~= Enum.HumanoidStateType.Jumping then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
task.spawn(function()
doubleJumpEnabled = false
end)
end
end
end
end)

EquipTool
機能: AvatarBehavior
Humanoid:EquipTool(tool:Instance):()
パラメータ
戻り値
()

GetAccessories
機能: AvatarAppearance
Humanoid:GetAccessories():{any}
戻り値
コードサンプル
ロード後にアクセサリーを削除
local Players = game:GetService("Players")
local function onPlayerAddedAsync(player)
local connection = player.CharacterAppearanceLoaded:Connect(function(character)
-- この時点ですべてのアクセサリーが読み込まれました
local humanoid = character:FindFirstChildOfClass("Humanoid")
local numAccessories = #humanoid:GetAccessories()
print(("%d 個のアクセサリーを %s のために破壊します"):format(numAccessories, player.Name))
humanoid:RemoveAccessories()
end)
-- プレイヤーが退出した後に接続を切断することを確認します
-- プレイヤーがガーベジコレクトされるのを許可するため
player.AncestryChanged:Wait()
connection:Disconnect()
end
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAddedAsync, player)
end
Players.PlayerAdded:Connect(onPlayerAddedAsync)

GetAppliedDescription
機能: AvatarAppearance
Humanoid:GetAppliedDescription():HumanoidDescription

GetBodyPartR15
機能: AvatarBehavior
Humanoid:GetBodyPartR15(part:Instance):Enum.BodyPartR15
パラメータ

GetLimb
機能: AvatarBehavior
Humanoid:GetLimb(part:Instance):Enum.Limb
パラメータ
戻り値
コードサンプル
ヒューマノイドの手足を取得
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
for _, child in pairs(character:GetChildren()) do
local limb = humanoid:GetLimb(child)
if limb ~= Enum.Limb.Unknown then
print(child.Name .. " は手足 " .. limb.Name .. " の一部です")
end
end

GetMoveVelocity
機能: AvatarBehavior
Humanoid:GetMoveVelocity():Vector3
戻り値

GetPlayingAnimationTracks
非推奨

GetRelativeVelocityAtFloor
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:GetRelativeVelocityAtFloor():Vector3
戻り値

GetState
並列書き込み
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:GetState():Enum.HumanoidStateType
コードサンプル
ダブルジャンプ
local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local doubleJumpEnabled = false
humanoid.StateChanged:Connect(function(_oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not doubleJumpEnabled then
task.wait(0.2)
if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
doubleJumpEnabled = true
end
end
elseif newState == Enum.HumanoidStateType.Landed then
doubleJumpEnabled = false
end
end)
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.Space then
if doubleJumpEnabled then
if humanoid:GetState() ~= Enum.HumanoidStateType.Jumping then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
task.spawn(function()
doubleJumpEnabled = false
end)
end
end
end
end)

GetStateEnabled
並列書き込み
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:GetStateEnabled(state:Enum.HumanoidStateType):boolean
パラメータ
戻り値
コードサンプル
ヒューマノイドの状態の設定と取得
local humanoid = script.Parent:WaitForChild("Humanoid")
-- 状態を設定
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
-- 状態を取得
print(humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping)) -- false

GetStatuses
非推奨

HasCustomStatus
非推奨

HasStatus
非推奨

LoadAnimation
非推奨

loadAnimation
非推奨

Move
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:Move(
moveDirection:Vector3, relativeToCamera:boolean
):()
パラメータ
moveDirection:Vector3
relativeToCamera:boolean
既定値: false
戻り値
()
コードサンプル
ヒューマノイドを前方に移動させる
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
RunService:BindToRenderStep("move", Enum.RenderPriority.Character.Value + 1, function()
if player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:Move(Vector3.new(0, 0, -1), true)
end
end
end)

MoveTo
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:MoveTo(
location:Vector3, part:Instance
):()
パラメータ
location:Vector3
既定値: "nil"
戻り値
()
コードサンプル
ヒューマノイドのタイムアウトなしの移動
local function moveTo(humanoid, targetPoint, andThen)
local targetReached = false
-- ヒューマノイドが目的地に到達したときのリスナー
local connection
connection = humanoid.MoveToFinished:Connect(function(reached)
targetReached = true
connection:Disconnect()
connection = nil
if andThen then
andThen(reached)
end
end)
-- 歩き始める
humanoid:MoveTo(targetPoint)
-- 関数をブロックせずに新しいスレッドで実行
task.spawn(function()
while not targetReached do
-- ヒューマノイドはまだ存在しますか?
if not (humanoid and humanoid.Parent) then
break
end
-- 目標は変更されましたか?
if humanoid.WalkToPoint ~= targetPoint then
break
end
-- タイムアウトをリフレッシュ
humanoid:MoveTo(targetPoint)
task.wait(6)
end
-- 接続がまだ接続されている場合は切断
if connection then
connection:Disconnect()
connection = nil
end
end)
end
local function andThen(reached)
print((reached and "目的地に到達しました!") or "目的地に到達できませんでした!")
end
moveTo(script.Parent:WaitForChild("Humanoid"), Vector3.new(50, 0, 50), andThen)

PlayEmote
非推奨

PlayEmoteAsync
イールド
機能: AvatarBehavior
Humanoid:PlayEmoteAsync(emoteName:string):boolean
パラメータ
emoteName:string
戻り値

RemoveAccessories
機能: AvatarAppearance
Humanoid:RemoveAccessories():()
戻り値
()
コードサンプル
ロード後にアクセサリーを削除
local Players = game:GetService("Players")
local function onPlayerAddedAsync(player)
local connection = player.CharacterAppearanceLoaded:Connect(function(character)
-- この時点ですべてのアクセサリーが読み込まれました
local humanoid = character:FindFirstChildOfClass("Humanoid")
local numAccessories = #humanoid:GetAccessories()
print(("%d 個のアクセサリーを %s のために破壊します"):format(numAccessories, player.Name))
humanoid:RemoveAccessories()
end)
-- プレイヤーが退出した後に接続を切断することを確認します
-- プレイヤーがガーベジコレクトされるのを許可するため
player.AncestryChanged:Wait()
connection:Disconnect()
end
for _, player in Players:GetPlayers() do
task.spawn(onPlayerAddedAsync, player)
end
Players.PlayerAdded:Connect(onPlayerAddedAsync)

RemoveCustomStatus
非推奨

RemoveStatus
非推奨

ReplaceBodyPartR15
機能: AvatarAppearance
Humanoid:ReplaceBodyPartR15(
bodyPart:Enum.BodyPartR15, part:BasePart
パラメータ
戻り値

SetStateEnabled
機能: AvatarBehavior
シミュレーションへのアクセス
Humanoid:SetStateEnabled(
):()
パラメータ
enabled:boolean
戻り値
()
コードサンプル
ジャンプクールダウン
local character = script.Parent
local JUMP_DEBOUNCE = 1
local humanoid = character:WaitForChild("Humanoid")
local isJumping = false
humanoid.StateChanged:Connect(function(_oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not isJumping then
isJumping = true
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
end
elseif newState == Enum.HumanoidStateType.Landed then
if isJumping then
isJumping = false
task.wait(JUMP_DEBOUNCE)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
end
end
end)

TakeDamage
機能: AvatarBehavior
Humanoid:TakeDamage(amount:number):()
パラメータ
amount:number
戻り値
()
コードサンプル
ヒューマノイドにダメージを与える
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
humanoid:TakeDamage(99)

takeDamage
非推奨

UnequipTools
機能: AvatarBehavior
Humanoid:UnequipTools():()
戻り値
()

イベント
AnimationPlayed
非推奨

ApplyDescriptionFinished
機能: AvatarAppearance
Humanoid.ApplyDescriptionFinished(description:HumanoidDescription):RBXScriptSignal
パラメータ

Climbing
機能: AvatarBehavior
Humanoid.Climbing(speed:number):RBXScriptSignal
パラメータ
speed:number
コードサンプル
ヒューマノイド.クライミング
local Players = game:GetService("Players")
local function onCharacterClimbing(character, speed)
print(character.Name, "は", speed, "スタッド/秒の速度で登っています。")
end
local function onCharacterAdded(character)
character.Humanoid.Climbing:Connect(function(speed)
onCharacterClimbing(character, speed)
end)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)

CustomStatusAdded
非推奨

CustomStatusRemoved
非推奨

Died
機能: AvatarBehavior
Humanoid.Died():RBXScriptSignal
コードサンプル
ヒューマノイド.Died
local Players = game:GetService("Players")
local function onPlayerAdded(player)
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local function onDied()
print(player.Name, "が死亡しました!")
end
humanoid.Died:Connect(onDied)
end
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)

FallingDown
機能: AvatarBehavior
Humanoid.FallingDown(active:boolean):RBXScriptSignal
パラメータ
active:boolean

FreeFalling
機能: AvatarBehavior
Humanoid.FreeFalling(active:boolean):RBXScriptSignal
パラメータ
active:boolean

GettingUp
機能: AvatarBehavior
Humanoid.GettingUp(active:boolean):RBXScriptSignal
パラメータ
active:boolean

HealthChanged
機能: AvatarBehavior
Humanoid.HealthChanged(health:number):RBXScriptSignal
パラメータ
health:number
コードサンプル
ヒューマノイド.ヘルス変更
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local currentHealth = humanoid.Health
local function onHealthChanged(health)
local change = math.abs(currentHealth - health)
print("ヒューマノイドのヘルスが", (currentHealth > health and "減少した" or "増加した"), change)
currentHealth = health
end
humanoid.HealthChanged:Connect(onHealthChanged)
end
player.CharacterAdded:Connect(onCharacterAdded)
ヘルスバー
local Players = game:GetService("Players")
local player = Players.LocalPlayer
-- スクリプトをフレーム内のフレームに
-- 親付けられたLocalScriptに貼り付ける
local frame = script.Parent
local container = frame.Parent
container.BackgroundColor3 = Color3.new(0, 0, 0) -- 黒
-- この関数はヒューマノイドのヘルスが変化したときに呼ばれます
local function onHealthChanged()
local human = player.Character.Humanoid
local percent = human.Health / human.MaxHealth
-- 内側のバーのサイズを変更する
frame.Size = UDim2.new(percent, 0, 1, 0)
-- ヘルスバーの色を変更する
if percent < 0.1 then
frame.BackgroundColor3 = Color3.new(1, 0, 0) -- 黒
elseif percent < 0.4 then
frame.BackgroundColor3 = Color3.new(1, 1, 0) -- 黄色
else
frame.BackgroundColor3 = Color3.new(0, 1, 0) -- 緑
end
end
-- この関数はプレーヤーがスポーンしたときに呼ばれます
local function onCharacterAdded(character)
local human = character:WaitForChild("Humanoid")
-- パターン: 現在一度更新し、その後ヘルスが変わるたびに
human.HealthChanged:Connect(onHealthChanged)
onHealthChanged()
end
-- スポーンリスナーを接続; すでにスポーンしている場合は呼び出す
player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then
onCharacterAdded(player.Character)
end

Jumping
機能: AvatarBehavior
Humanoid.Jumping(active:boolean):RBXScriptSignal
パラメータ
active:boolean

MoveToFinished
機能: AvatarBehavior
Humanoid.MoveToFinished(reached:boolean):RBXScriptSignal
パラメータ
reached:boolean
コードサンプル
ヒューマノイドのタイムアウトなしの移動
local function moveTo(humanoid, targetPoint, andThen)
local targetReached = false
-- ヒューマノイドが目的地に到達したときのリスナー
local connection
connection = humanoid.MoveToFinished:Connect(function(reached)
targetReached = true
connection:Disconnect()
connection = nil
if andThen then
andThen(reached)
end
end)
-- 歩き始める
humanoid:MoveTo(targetPoint)
-- 関数をブロックせずに新しいスレッドで実行
task.spawn(function()
while not targetReached do
-- ヒューマノイドはまだ存在しますか?
if not (humanoid and humanoid.Parent) then
break
end
-- 目標は変更されましたか?
if humanoid.WalkToPoint ~= targetPoint then
break
end
-- タイムアウトをリフレッシュ
humanoid:MoveTo(targetPoint)
task.wait(6)
end
-- 接続がまだ接続されている場合は切断
if connection then
connection:Disconnect()
connection = nil
end
end)
end
local function andThen(reached)
print((reached and "目的地に到達しました!") or "目的地に到達できませんでした!")
end
moveTo(script.Parent:WaitForChild("Humanoid"), Vector3.new(50, 0, 50), andThen)

PlatformStanding
機能: AvatarBehavior
Humanoid.PlatformStanding(active:boolean):RBXScriptSignal
パラメータ
active:boolean

Ragdoll
機能: AvatarBehavior
Humanoid.Ragdoll(active:boolean):RBXScriptSignal
パラメータ
active:boolean

Running
機能: AvatarBehavior
Humanoid.Running(speed:number):RBXScriptSignal
パラメータ
speed:number
コードサンプル
ヒューマノイドのランニング
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local function onRunning(speed: number)
if speed > 0 then
print(`{localPlayer.Name} はランニングしています`)
else
print(`{localPlayer.Name} は停止しました`)
end
end
humanoid.Running:Connect(function(speed: number)
onRunning(speed)
end)

Seated
機能: AvatarBehavior
Humanoid.Seated(
active:boolean, currentSeatPart:BasePart
パラメータ
active:boolean
currentSeatPart:BasePart
コードサンプル
プレイヤーの座席を見つける
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local function onSeated(isSeated, seat)
if isSeated then
print("今座っているのは: " .. seat.Name .. "です!")
else
print("何にも座っていません")
end
end
humanoid.Seated:Connect(onSeated)

StateChanged
機能: AvatarBehavior
コードサンプル
ジャンプするパーティクル
local character = script.Parent
local primaryPart = character.PrimaryPart
-- パーティクルを作成する
local particles = Instance.new("ParticleEmitter")
particles.Size = NumberSequence.new(1)
particles.Transparency = NumberSequence.new(0, 1)
particles.Acceleration = Vector3.new(0, -10, 0)
particles.Lifetime = NumberRange.new(1)
particles.Rate = 20
particles.EmissionDirection = Enum.NormalId.Back
particles.Enabled = false
particles.Parent = primaryPart
local humanoid = character:WaitForChild("Humanoid")
local isJumping = false
-- ヒューマノイドの状態を監視する
local function onStateChanged(_oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not isJumping then
isJumping = true
particles.Enabled = true
end
elseif newState == Enum.HumanoidStateType.Landed then
if isJumping then
isJumping = false
particles.Enabled = false
end
end
end
humanoid.StateChanged:Connect(onStateChanged)
ジャンプクールダウン
local character = script.Parent
local JUMP_DEBOUNCE = 1
local humanoid = character:WaitForChild("Humanoid")
local isJumping = false
humanoid.StateChanged:Connect(function(_oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not isJumping then
isJumping = true
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
end
elseif newState == Enum.HumanoidStateType.Landed then
if isJumping then
isJumping = false
task.wait(JUMP_DEBOUNCE)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
end
end
end)

StateEnabledChanged
機能: AvatarBehavior
Humanoid.StateEnabledChanged(
パラメータ
isEnabled:boolean
コードサンプル
ヒューマノイド状態変更検出器
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local function onStateEnabledChanged(state, enabled)
if enabled then
print(state.Name .. " は有効になりました")
else
print(state.Name .. " は無効になりました")
end
end
humanoid.StateEnabledChanged:Connect(onStateEnabledChanged)

StatusAdded
非推奨

StatusRemoved
非推奨

Strafing
機能: AvatarBehavior
Humanoid.Strafing(active:boolean):RBXScriptSignal
パラメータ
active:boolean

Swimming
機能: AvatarBehavior
Humanoid.Swimming(speed:number):RBXScriptSignal
パラメータ
speed:number

Touched
機能: AvatarBehavior
Humanoid.Touched(
touchingPart:BasePart, humanoidPart:BasePart
パラメータ
touchingPart:BasePart
humanoidPart:BasePart
コードサンプル
ミダスの手
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local partInfo = {}
local debounce = false
local function onHumanoidTouched(hit, _limb)
if debounce then
return
end
if not hit.CanCollide or hit.Transparency ~= 0 then
return
end
if not partInfo[hit] then
partInfo[hit] = {
BrickColor = hit.BrickColor,
Material = hit.Material,
}
hit.BrickColor = BrickColor.new("Gold")
hit.Material = Enum.Material.Ice
debounce = true
task.wait(0.2)
debounce = false
end
end
local touchedConnection = humanoid.Touched:Connect(onHumanoidTouched)
local function onHumanoidDied()
if touchedConnection then
touchedConnection:Disconnect()
end
-- 全ての金を元に戻す
for part, info in pairs(partInfo) do
if part and part.Parent then
part.BrickColor = info.BrickColor
part.Material = info.Material
end
end
end
humanoid.Died:Connect(onHumanoidDied)

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。