0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Roblox】HumanoidDescription でキャラクターの外観を設定する

0
Last updated at Posted at 2026-02-27

はじめに

Humanoid.HumanoidDescription を設定して、キャラクターの見た目に反映する方法です。
HumanoidDescription の取得方法を中心に書いています。

環境:
Roblox Studio: バージョン 0.710.0.7100702

キャラクターは、 Roblox Studio 内の アバター > キャラクター で追加しました。
Workspace 直下に配置し、名前は「Rig」(デフォルト)です。

🎩キャラクターの外観への反映方法

Humanoid:ApplyDescriptionAsync() で、Humanoid(キャラクター)に対して指定の HumanoidDescription を適用することができます。

参考:
Engine API - Classes - Humanoid#ApplyDescription

local npc = workspace:FindFirstChild("Rig")
local humanoid = npc:FindFirstChild("Humanoid")
humanoid:ApplyDescriptionAsync(humanoidDescription)

🎩HumanoidDescriptionの取得

🧩バンドルから取得する方法

Players:GetHumanoidDescriptionFromOutfitIdAsync() で、アウトフィットID に対応するHumanoidDescription を取得できます。
AssetService:GetBundleDetailsAsync() はバンドルIDからバンドルの詳細情報を返すので、そのバンドル情報からアウトフィットIDを取得します。

参考:
Engine API - Classes - Players#GetHumanoidDescriptionFromOutfitIdAsync
Engine API - Classes - AssetService#GetBundleDetailsAsync

local Players = game:GetService("Players")

-- バンドルIDに対応するアウトフィットIDを取得
local function getOutfitId(bundleId)
	if bundleId <= 0 then
		return
	end
	local info = game.AssetService:GetBundleDetailsAsync(bundleId)
	if not info then
		return
	end
	for _, item in info.Items do
		if item.Type == "UserOutfit" then
			return item.Id
		end
	end

	return nil
end

-- バンドルIDに対応する HumanoidDescription を取得
local function getHumanoidDescriptionBundle(bundleId)
	local outfitId = getOutfitId(bundleId)
	print("outfitId", outfitId)
	if outfitId and outfitId > 0 then
		-- アウトフィットに対応する HumanoidDescription を返却
		return Players:GetHumanoidDescriptionFromOutfitIdAsync(outfitId)
	end

	return nil
end

-- npc に HumanoidDescription を適用
local bundleId = 149380187421681  -- 例
local humanoidDescription = getHumanoidDescriptionBundle(bundleId)
local npc = workspace:FindFirstChild("Rig")
local humanoid = npc:FindFirstChild("Humanoid")
humanoid:ApplyDescriptionAsync(humanoidDescription)

🧩キャラクターから取得する方法

Humanoid:GetAppliedDescription() で、その Humanoid(キャラクター) が持つ HumanoidDescription を取得します。
以下は 取得した HumanoidDescription のプロパティを上書きする例です。

参考:
Engine API - Classes - Humanoid#GetAppliedDescription

-- HumanoidDescripton のプロパティを上書き
local npc = workspace:FindFirstChild("Rig")
local humanoid = npc:FindFirstChild("Humanoid")
local humanoidDescription = humanoid:GetAppliedDescription()
humanoidDescription.HatAccessory = "2551510151,2535600138"
humanoidDescription.BodyTypeScale = 0.1
humanoidDescription.ClimbAnimation = 619521311
humanoidDescription.Face = 86487700
humanoidDescription.GraphicTShirt = 1711661
humanoidDescription.HeadColor = Color3.new(0, 1, 0)

-- npc に HumanoidDescription を適用
humanoid:ApplyDescriptionAsync(humanoidDescription)

🧩ユーザーから取得する方法

Players:GetHumanoidDescriptionFromUserIdAsync() でユーザーIDを指定して、HumanoidDescription を取得します。

参考:
Engine API - Classes - Players#GetHumanoidDescriptionFromUserIdAsync

-- ユーザーIDから HumanoidDesription を取得
local Players = game:GetService("Players")
local userId = 1
local humanoidDescription = 
	Players:GetHumanoidDescriptionFromUserIdAsync(userId)

-- npc に HumanoidDescription を適用
local npc = workspace:FindFirstChild("Rig")
local humanoid = npc:FindFirstChild("Humanoid")
humanoid:ApplyDescriptionAsync(humanoidDescription)

🎩 キャラクターの作成

CreateHumanoidModelFromDescriptionAsync() は 指定した HumanoidDescription を適用した Humanoid を作成します。

getHumanoidDescriptionBundle() は、 バンドルIDからHumanoidDescriptionを取得する方法 (前述)に書いています。

参考:
Engine API - Classes - Players#CreateHumanoidModelFromDescriptionAsync

-- 取得したHumanoidDescriptionをもとに、キャラクターを作成して Workspace に追加
local bundleId = 149380187421681
local humanoidDescription = getHumanoidDescriptionBundle(bundleId)
local humanoidModel = Players:CreateHumanoidModelFromDescriptionAsync(
	humanoidDescription, Enum.HumanoidRigType.R15)
humanoidModel.Parent = workspace

その他参考

公式リファレンス

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?