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.
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.
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})
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.