Shirt
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
The Shirt nesnesi, bir Humanoid kaldıraç üzerinde Roblox'tan bir gömlek dokusu görüntüler.Gömlekler gövde ve kolları kaplar ve gövdede bir Pants üzerinde öncelik alır.Görünür olmak için, bir Shirt kardeşi bir Humanoid ve onun ShirtTemplate özelliklerinin bir uygun dokuya ayarlanması gerekir, örneğin rbxassetid://86896487.Gömlek dokusu, Clothing.Color3 özelliğini kullanarak renklendirilebilir.
Gömlekler, avatarları bir tane giyiyorsa otomatik olarak Player karakterlerine yüklenir.
Kod Örnekleri
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.
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
Özet
Özellikler
ShirtTemplate
Roblox'ta barındırılan gömlek şablonuna işaret eden içerik kimlik bağlantısı.
Bu içerik kimliği tişörtün web sitesi URL'sinden farklıdır.Gömleğin URL'sini Studio'daki GömlekŞablonu özelliğine yapıştırarak bulunabilir.Alternatif olarak, InsertService:LoadAsset() örneğin gömleği çalışma alanına sokmak için kullanılabilir:
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
Tişörtlere uygulanan görüntü için de ShirtGraphic.Graphic bakın.
Kod Örnekleri
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.
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