Hello I currently am trying to give the player a specific shirt. Bassically the player enters a AssetID from the catalog and it gives that shirt.
here is my script
local function giveShirt(plr, id)
local char = plr.Character
if char:FindFirstChildOfClass("Shirt") then
char:FindFirstChildOfClass("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=" .. id
the issue is that the AssetId from the catalog is not the same assetID used on shirtTemplates and therefor it will not work. I dont know how to convert the assetid from catalog to shirttemplate id.
So how do I convert the assetid from catalog to shirttemplate id?
local HttpService = game:GetService(“HttpService”)
local assetId = 123456789 – Replace with your AssetId
local function convertAssetIdToShirtTemplateId(assetId)
local url = string.format(“https://api.roblox.com/asset-thumbnail/image?assetId=%d&width=1&height=1”, assetId)
local response = HttpService:GetAsync(url, false)
local decodedResponse = HttpService:JSONDecode(response)
local shirtTemplateId = convertAssetIdToShirtTemplateId(assetId)
This will hopefully print you the shirttemplate id.
Go to Game Settings and then avatar and scroll down until you see set avatar stuff
I just used insert service.
local Asset = 0 – put shirt id from catalog here
local plr = – somehow get a player instance
local newShirt = game:GetService(“InsertService”):LoadAsset(Asset)
newShirt:FindFirstChildOfClass(“Shirt”).Parent = plr.Character
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.