Shirt

非推奨を表示

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

Shirt オブジェクトは、Humanoid リグに Roblox からシャツテクスチャを表示します。シャツは胴体と腕を覆い、胴体上の Pants より優先されます。表示されるには、ShirtHumanoid の兄弟であり、ShirtTemplate のプロパティが適切なテクスチャ(例: rbxassetid://86896487)に設定されている必要があります。シャツのテクスチャは、Clothing.Color3 プロパティを使用して色付きにすることができます。

アバターが着用している場合、シャツは自動的に Player 文字にロードされます。

コードサンプル

This sample includes a simple function to change the texture of the Shirt and Pants worn by a player's character. If shirt and pants don't exist then they are created. Note, this should be run every time the character spawns. If a developer is looking to permanently change a character's appearance to a preset it is recommended they use Player.CharacterAppearance.

Change Shirt / Pants

local Players = game:GetService("Players")
local function replaceClothes(player)
local character = player.Character
if character then
-- look for shirts / pants
local shirt = character:FindFirstChildOfClass("Shirt")
local pants = character:FindFirstChildOfClass("Pants")
-- create shirts / pants if they don't exist
if not shirt then
shirt = Instance.new("Shirt")
shirt.Parent = character
end
if not pants then
pants = Instance.new("Pants")
pants.Parent = character
end
-- reset shirt / pants content ids
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=83326831"
pants.PantsTemplate = "http://www.roblox.com/asset/?id=10045638"
end
end
for _index, player in ipairs(Players:GetPlayers()) do
replaceClothes(player)
end

プロパティ

ShirtTemplate

ContentId
並列読み取り

Roblox にホストされているシャツテンプレートへのコンテンツ ID リンク。

このコンテンツIDは、シャツのウェブサイト URLと異なります。スタジオの ShirtTemplate プロパティにシャツのウェブサイト URLを貼り付けることで見つけることができます。代わりに、InsertService:LoadAsset() は、例えばワークスペースにシャツを挿入するのに使用できます:


local InsertService = game:GetService("InsertService")
local Workspace = game:GetService("Workspace")
local webURL = "https://www.roblox.com/catalog/1804747/White-Shirt"
local assetId = tonumber(string.match(webURL, "%d+") or 0) -- Extract the number
local success, model = pcall(function()
return InsertService:LoadAsset(assetId)
end)
if success then
model.Parent = Workspace
end

Tシャツに適用された画像については、ShirtGraphic.Graphic も参照してください。

コードサンプル

This sample includes a simple function to change the texture of the Shirt and Pants worn by a player's character. If shirt and pants don't exist then they are created. Note, this should be run every time the character spawns. If a developer is looking to permanently change a character's appearance to a preset it is recommended they use Player.CharacterAppearance.

Change Shirt / Pants

local Players = game:GetService("Players")
local function replaceClothes(player)
local character = player.Character
if character then
-- look for shirts / pants
local shirt = character:FindFirstChildOfClass("Shirt")
local pants = character:FindFirstChildOfClass("Pants")
-- create shirts / pants if they don't exist
if not shirt then
shirt = Instance.new("Shirt")
shirt.Parent = character
end
if not pants then
pants = Instance.new("Pants")
pants.Parent = character
end
-- reset shirt / pants content ids
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=83326831"
pants.PantsTemplate = "http://www.roblox.com/asset/?id=10045638"
end
end
for _index, player in ipairs(Players:GetPlayers()) do
replaceClothes(player)
end

方法

イベント