Shirt

Veraltete anzeigen

*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.

Das Shirt Objekt zeigt eine Hemdtextur von Roblox auf einem Humanoid Rig an.Hemden bedecken den Torso und die Arme und haben Vorrang vor einem Pants auf dem Torso.Um sichtbar zu sein, muss ein Shirt ein Geschwisterteil eines Humanoid sein und seine ShirtTemplate Eigenschaft auf eine geeignete Textur wie rbxassetid://86896487 festlegen.Die Hemdtextur kann mit der EigenschaftenClothing.Color3 koloriert werden.

Hemden werden automatisch auf Player Zeichen geladen, wenn ihr Avatar eines trägt.

Code-Beispiele

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

Zusammenfassung

Eigenschaften

Eigenschaften von Clothing übernommen
  • Parallel lesen

    Legt die Farbgebung fest, die auf die Clothing Textur angewendet werden soll.

Eigenschaften

ShirtTemplate

ContentId
Parallel lesen

Der Inhalts-ID-Link, der auf die Hemdvorlage zeigt, die auf Roblox gehostet wird.

Diese Inhalts-ID ist anders als die URL der Website des Hemds.Es kann durch Einfügen der Website-URL des Hemds in das Eigenschaftsfeld Hemdvorlage im Studio gefunden werden.Alternativ kann InsertService:LoadAsset() verwendet werden, um das Hemd in den Arbeitsbereich einzufügen, zum Beispiel:


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

Siehe auch ShirtGraphic.Graphic für das Bild, das auf T-Shirts angewendet wird.

Code-Beispiele

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

Methoden

Ereignisse