I am working on a game similar to the well known game “Pls Donate”. So far I am able to get all of the players gamepasses but I cannot figure out how to get the gamepasses thumbnails and then display them on a image label. Anything is helpful, I have been stuck on this for hours
No I have not. But it looks promising!
It’s not just promising it’s what you want!
In specific,
local function GetAssetImage(ID)
local Asset = MarketplaceService:GetProductInfo(ID)
if Asset.AssetTypeId == 10 then
-- // Return the formatted Asset Image, for use on ImageLabels/etc.
return "rbxassetid://" .. Asset.IconImageAssetId
end
end
Edit: Enum.AssetType doesn’t line up right. That’s dumb. Anyways fixed it. AssetTypeId “10” is equivalent to Gamepasses.
if you’re specifically looking for gamepasses, the code can be shorter as in GetProductInfo, a second argument can be passed which is the InfoType
if you’re only looking for gamepasses
local function GetAssetImage(ID)
local Asset = MarketplaceService:GetProductInfo(ID, 2)
return "rbxassetid://" .. Asset.IconImageAssetId
end
all you’ll need to do then is call the function with the gamepass ID
local image = GetAssetImage(ID)
just make sure there’s a 2 as the second argument or it could pass as a shirt, product, etc.
Indeed this is the best way, I’m just tired and didn’t think about that.
It’s 2:03 AM I think I’ll go to sleep.
ImageLabel.Image = "rbxthumb://type=GamePass&w=150&h=150&id=0" --Change '0' to gamepass's ID.
Also methods that rely on network calls, i.e; GetProductInfo
should be wrapped inside a call to pcall
as they will error if the network call fails.