範例程式碼
更換襯衫 / 褲子
local Players = game:GetService("Players")
local function replaceClothes(player)
local character = player.Character
if character then
-- 尋找襯衫 / 褲子
local shirt = character:FindFirstChildOfClass("Shirt")
local pants = character:FindFirstChildOfClass("Pants")
-- 如果襯衫 / 褲子不存在則創建
if not shirt then
shirt = Instance.new("Shirt")
shirt.Parent = character
end
if not pants then
pants = Instance.new("Pants")
pants.Parent = character
end
-- 重置襯衫 / 褲子的內容 id
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)
endAPI 參考
屬性
ShirtTemplate
Shirt.ShirtTemplate:ContentId
範例程式碼
更換襯衫 / 褲子
local Players = game:GetService("Players")
local function replaceClothes(player)
local character = player.Character
if character then
-- 尋找襯衫 / 褲子
local shirt = character:FindFirstChildOfClass("Shirt")
local pants = character:FindFirstChildOfClass("Pants")
-- 如果襯衫 / 褲子不存在則創建
if not shirt then
shirt = Instance.new("Shirt")
shirt.Parent = character
end
if not pants then
pants = Instance.new("Pants")
pants.Parent = character
end
-- 重置襯衫 / 褲子的內容 id
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