Pants

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

Pants 개체는 Humanoid 리그에서 Roblox의 바지 텍스처를 표시합니다.바지는 몸통과 다리를 덮고, 몸통에 Shirt가 덮일 것입니다.가시적이려면 PantsHumanoid 의 형제이어야 하고 PantsTemplate 속성이 적절한 텍스처(예: rbxassetid://86896501 )로 설정되어야 합니다.바지 텍스처는 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

속성

PantsTemplate

ContentId
병렬 읽기

Roblox에 호스팅된 바지 템플릿에 연결하는 콘텐츠 ID 링크.

이 콘텐츠 ID는 바지의 웹사이트 URL과 다릅니다.Studio의 PantsTemplate 속성에 바지의 웹사이트 URL을 붙여넣어 찾을 수 있습니다.또는 InsertService:LoadAsset() 를 사용하여 바지를 작업 영역에 삽입할 수 있습니다. 예를 들어:


local InsertService = game:GetService("InsertService")
local Workspace = game:GetService("Workspace")
local webURL = "https://www.roblox.com/catalog/1804739/Jeans"
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

Shirt 개체의 템플릿에 대해서는 Shirt.ShirtTemplate를 참조하십시오.

코드 샘플

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

메서드

이벤트