Shirt 개체는 Humanoid 리그에서 Roblox의 셔츠 텍스처를 표시합니다.셔츠는 몸통과 팔을 덮고, 몸통에서 Pants 위에 우선 순위를 가질 것입니다.가시적이려면 Shirt 가 Humanoid 의 형제이어야 하고 ShirtTemplate 속성이 적절한 텍스처(예: rbxassetid://86896487 )로 설정되어야 합니다.셔츠 텍스처는 Clothing.Color3 속성을 사용하여 색상화할 수 있습니다.
아바타가 착용하고 있는 경우 Player 문자에 셔츠가 자동으로 로드됩니다.
코드 샘플
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과 다릅니다.스튜디오의 셔츠템플릿 속성에 셔츠의 웹사이트 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
티셔츠에 적용된 이미지에 대해서는 ShirtGraphic.Graphic를 참조하십시오.
코드 샘플
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
Clothing에서 상속된 속성