How can I get the image for a gamepass and put it on an imagelabel?

I need to put an image onto a imagelabel from a gamepass. How can I do this?

Current code:

local gamepasses = {1,2,3,4,5,6,7,8} --placeholders, gamepasses will be added soon
local template = script.Parent.Template
local marketplaceService = game:GetService("MarketplaceService")

for i, v in pairs(gamepasses) do
	local cloned = template:Clone()
	local gpInfo = marketplaceService:GetProductInfo(v, Enum.InfoType.Product)
	cloned.ImageLabel.Image = "rbxassetid://"..gpInfo	
end

You just need to change this line to cloned.ImageLabel.Image = "rbxassetid://"..gpInfo.IconImageAssetId


Also keep in mind, if you’re going to use Game Passes instead of Developer Products here, change this to Enum.InfoType.GamePass

Don’t forget to mark my post as solution if it helped. Not trying to be greedy or anything, but it helps keep the forum clean

1 Like

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