Shirt

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

วัตถุ Shirt แสดงเทกเจอร์เสื้อจาก Roblox บนแรม Humanoidเสื้อคลุมท่อนลำตัวและแขน และจะได้รับความสำคัญมากกว่า Pants บนท่อนลำตัวเพื่อให้มองเห็นได้ ต้องมี Shirt เป็นพี่น้องของ Humanoid และมีค่า 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
    อ่านพร้อมๆ กัน

    กำหนดเทกเจอร์ของ Shirt .

คุณสมบัติรับทอดมาจากClothing
  • อ่านพร้อมๆ กัน

    กำหนดการเปลี่ยนสีที่จะใช้กับเทกเจอร์ Clothing

คุณสมบัติ

ShirtTemplate

ContentId
อ่านพร้อมๆ กัน

ลิงค์รหัสเนื้อหาที่ชี้ไปที่เทมเพลตเสื้อที่โฮสต์บน Roblox

ID เนื้อหานี้แตกต่างจาก URL เว็บไซต์ของเสื้อสามารถค้นหาได้โดยการวางที่อยู่เว็บไซต์ของเสื้อในคอลัมน์ ShirtTemplate ใน Studioอีกทางหนึ่ง 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 สำหรับภาพที่ใช้กับเสื้อยืด

ตัวอย่างโค้ด

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

วิธีการ

อีเวนต์