Getting TShirt Image Icon Through Script

How do you get the icon or image of a t-shirt asset id through script? When I paste the assetid into a decal’s image it automatically sets it to http://www.roblox.com/asset/?id=0000000 but the zeros being the ID, however the ID changes after being pasted into the image from the original assetid. Is there a way to calculate the offset of the ids or is there another method? for example, when I paste this assetid into an image: 13147120692 it transforms into this: http://www.roblox.com/asset/?id=13026165825 The Ids at the end are different by 20, but on other tshirts I don’t always get a 20 difference. If only when I made the image the assetid it would automatically convert to the image like in regular Studio. What should I do here?

All you have to do is take the image on the T Shirt and make it a decal. Then it is now an image.

Other than that, I don’t see why you would want to calculate that stuff.

1 Like

Thank you, but I’m trying to get the icons of player’s tshirts for sale and have to change icons for them through a script. If this was just for my own tshirts then yes, I wouldn’t even have to make a decal for them I could just paste the assetid in and then Stydio automatically converts it to the string that gets the tshirt icon that I’m looking for.

You want the image icon to show as a GUI element?
To get the thumbnail of an asset you can insert this line into the ImageLabel/Button:
rbxthumb://type=Asset&id=13147120692&w=420&h=420

Or you want the texture ID to use in the Shirt Instance?
You have the asset ID, as you notice when placing it inside the Shirt instance becomes a different a number which is the texture ID to be applied in the character’s shirt instance

2 Likes

Yes it’s for a ui element but inside of a script.

Yeah, then use the line I suggested:

Just merge a string using the asset ID you have. Like:

"rbxthumb://type=Asset&id="..tostring(YourID).."&w=420&h=420"

You can even change the desired size of the thumbnail, the example I provided is using 420px

1 Like

Oh yeah that’s different from http://www.roblox.com/asset/?id=(ID)

It works like a charm, thank you so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.