Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Get Shirt Template ID with Shirt ID?

Asked by 3 years ago

Hello everyone!

Please delete this if not allowed; I am trying to create a GUI that allows someone to enter a shirt ID. Using that, it puts it on their character. I wrote a script that works, but it puts on some random shirt because the shirt ID doesn't match the Shirt Template ID. Does anyone know how to get around this?

e.g,

-- shirtId is input from the player
local shirt = Instance.new("Shirt")
shirt.Parent = player

shirt.ShirtTemplate = http://www.roblox.com/asset/?id= .. shirtId

1 answer

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

You can use InsertService to create a shirt with the shirtId and copy its template Id.

local shirt = Instance.new("Shirt")
shirt.Parent = player
local asset = game:GetService("InsertService"):LoadAsset(shirtId)

shirt.ShirtTemplate = asset:FindFirstChildOfClass("Shirt").ShirtTemplate

asset:Destroy()
1
Thanks!! Amanda314159 291 — 3y
Ad

Answer this question