Apply a game icon onto a Image Label based off a game ID

Hey! I am looking to figure out how to apply a Roblox game icon, onto a image label.

The issue is that when I put in the game ID in the spot where it goes, when I try it in-game it just appears invisible.

The code I have got, is from the DevForum, but it doesn’t seem to work in my case. I have tried looking at other DevForums, and most of them are unsolved or don’t help my situation.

Basicly I just am looking to put any game I select by grabbing the GameID and puting it in the variable, then it displays what ever game icon of the ID that there is onto a Image Label.

local GameID = 15627348946

script.Parent.Image = ("rbxIcon://type=GameIcon&id=%d&w=%d&h=%d"):format(GameID, 256, 256)

This is what happens when I run that code:
image

1 Like

there’s an easier way to do this

local PLACEID = 15627348946

local Product = game:GetService("MarketplaceService")
local Details = Product:GetProductInfo(PLACEID)
local IconID = Details.IconImageAssetId

script.Parent.Image = "rbxassetid://"..IconID

may want to put a pcall so it doesn’t error when Roblox servers are down

3 Likes

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