Getting Shirt Image from It's ID

Hello,
So I’ve been trying to get a Shirt image from a Shirt ID. I’ve been looking for this for a few hours now. Looked over through the DevForum and YouTube and sadly no results. I’m not sure if there is any official way of getting it, But it’s possible as I’ve seen it in games like PLS Donate.

Any help would be appreciated.

Try checking this post out:

Can you give an example using this? Like for example if you have the ID

local ID = 32323232]


-- How do I load it?

You can use this script to get the image of any shirt or anything, really.
local Id = 32323232
local Image = game:HttpGetAsync(“https://assetgame.roblox.com/Asset?id=” … Id)

Is there any official way doing this or Do I have to really use HTTP Service? My game relies on HTTP Service too much and I don’t really want to make the game slower.

People care more about having a functional game than shorter load times.

Not really, they want the Content in your game fast because if it’s not, They would leave and play other game Plus my game already takes 5 secs to load the Player items I don’t wanna relay on HTTP Service too much.

Is there any official way or do I have to use HTTP Service??

You’d usually plug it up to a pre-existing link template, like how @xDeltaXen mentioned with using HttpService.

But, if I’m not mistaken, you can still do the exact same thing as if it was a decal; Just with a different string format. They even made it easier of getting the RbxThumb of a certain item as well. So with this in mind, you probably don’t even need HttpService at all… you may need to preload it with ContentProvider though. Here’s an example code getting the thumbnail of your pants.

local ContentProvider = game:GetService("ContentProvider")

local AssetTypes = require(script.AssetType) -- I preferr this method, honestly.
-- It makes the script less messy and more organized.
-- The module (except for the AssetTypes:Verify() function) itself isn't important.
local ImageThumbnail = script.Parent.Parent.ImageLabel

local rbxThumbUrl_Template = "rbxthumb://type=%s&id=%s&w=%d&h=%d" -- URL Format

local function GetRbxThumbFor(assetType: string, id: number | string, size: {number})
	local AssetType, AssetInfo = AssetTypes:Verify(assetType)
	
	if AssetInfo then
		return rbxThumbUrl_Template:format(AssetType, tostring(id), size[1], size[2])
	end
end

local ID = "398633812"
local url = GetRbxThumbFor("Asset", ID, AssetTypes.Asset.SupportedSizes[2]) 
-- Yeah, anything that's within the category (excluding bundles) are assets.		
ImageThumbnail.Image = url
ContentProvider:PreloadAsync({url})
2 Likes

Hey! Thanks for replying, But a little question where do I get that module you are requiring?

To be quite honest, I’ve created that module myself. It was just for this, it kept the data of the supported sizes of each asset type and verifying if a string exactly matches one of the asset names.

Do you want me to also paste the code for the module then?
And please, if this did help you get what you wanted, mark it as a solution for others to know.

Yes, that would be helpful.

local AssetTypes = {
	Asset = {
		SupportedSizes = {
			{150, 150},
			{420, 420}
		}
	},
	Avatar = {
		SupportedSizes = {
			{100, 100},
			{350, 350},
			{720, 720}
		}
	},
	AvatarHeadShot = {
		SupportedSizes = {
			{48, 48},
			{60, 60},
			{150, 150}
		}
	},
	BadgeIcon = {
		SupportedSizes = {
			{150, 150}
		}
	},
	BundleThumbnail = {
		SupportedSizes = {
			{150, 150},
			{420, 420}
		}
	},
	GameIcon = {
		SupportedSizes = {
			{50, 50},
			{150, 150}
		}
	},
	GamePass = {
		SupportedSizes = {
			{150, 150}
		}
	},
	GroupIcon = {
		SupportedSizes = {
			{150, 150},
			{420, 420}
		}
	},
	Outfit = {
		SupportedSizes = {
			{150, 150},
			{420, 420}
		}
	}
}

function AssetTypes:Verify(name)
	for aName, asset in pairs(AssetTypes) do
		if aName == name then
			return aName, asset
		end
	end
	
	return "NaN", nil
end

return AssetTypes
1 Like

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