Using Roblox's API to get the Icon from a game

  1. What do you want to achieve?
    Get a game’s Icon to display it on a decal.

  2. What is the issue?
    I can’t seem to find any method for getting a games Icon, though from using this I am able to get the imageUrl which looks like this:

https://tr.rbxcdn.com/46ecfa4df47bcb298e51889de4bf45e2/512/512/Image/Png
  1. What solutions have you tried so far?
    I have tried using v2/games/media linked here when I get the imageId from this I get a textureId looking something like “0000000” though the only problem with this is that I get the thumbnails and not the game Icon.

Does anyone have a better way of doing this or an idea how to get the iconId instead of getting the URL which cannot be used with decals.

The code basically makes a decal and puts it on a surface to a part.
The code I’m working with is here:

local boardLocation = game:GetService("Workspace").Board


-- Properties

local universalId = 2464573238 -- The Game's universal id

-- Variables

local gameIcon = boardLocation.GameIcon

local gameTitle = boardLocation.GameTitle
local gameDescription = boardLocation.GameDescription


-- Proxy

local HttpService = game:GetService("HttpService")

local ProxyService = require(game.ServerScriptService.ProxyService)
local Proxy = ProxyService:New('', '')
local gameProxy = Proxy:Get('https://thumbnails.roblox.com/v1/games/icons?universeIds='..universalId..'&size=512x512&format=Png&isCircular=false').body

local gameProxyImageId = HttpService:JSONDecode(gameProxy).data[1].imageUrl

local iconId = "rbxassetid://"..gameProxyImageId


-- OnStart (Creating decals and text)

local function onStart()
    
    --
    local iconDecal = Instance.new("Decal")
    
    iconDecal.Name = "ImageIcon"
    iconDecal.Parent = gameIcon
    iconDecal.Face = Enum.NormalId.Back
    
    iconDecal.Texture = iconId
    
    print(iconDecal.Texture)
    
    --
end

onStart()
2 Likes

You don’t need to use an API endpoint for this, you can instead use the RbxThumb contentId format.

image.Image = rbxthumb://type==GameIcon&id={UniverseIdHere}&w=150&h=150

When I try to apply the RbxThumb to the texture it wont popup. The post you linked seemes to apply to ImageLabels? I might be overlooking something, but this solution doesn’t work.

It works for me. You need to use the game’s universeId, not its placeId.

rbxthumb://type=GameIcon&id={UniverseId}&w=150&h=150

I think this will help you

Image = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..PlaceRootId.."&fmt=png&wd=420&ht=420"
1 Like

No, placeID worked for me.

I’m referring to use of RbxThumb.

1 Like

This gets the thumbnail image, not GameIcon

1 Like

I was using the UnversalId, still it wouldn’t apply to it.

Now after trying it again it suddenly works surprise. I was using universal id the first time as well so I’m not sure what fixed it? Thanks for your solution!

1 Like