Are you trying to get the game icons of all the user’s favorite games?
Close but no. I’m trying to get the icons of all the users favorites in total.
(Yes you heard me right, all of it)
Well if you want the game icon of a user’s favorite game, this asset url might work:
"rbxthumb://type=GameIcon&id="..v.Item.AssetId.."&w=150&h=150"
Not sure if the AssetId has to be the game’s PlaceId or GameId/UniverseId though.
The method I’m using is universal however the name isnt.
I wanted to ask if it was possible to automatically detect the name of the assetype with the information I have of the product
Yeah, you can do:
game:GetService("MarketplaceService"):GetProductInfo(id).AssetType
as you said before. Btw, this may be useful to you:
It says MarketplaceService:getProductInfo() failed because HTTP 400 (Bad Request)
my code:
clone.Image = "rbxthumb://type=".. game:GetService("MarketplaceService"):GetProductInfo(v.Item.AssetType).AssetType .."&id="..v.Item.AssetId .."&w=420&h=420"
Enable HTTP requests.
Game settings > Security > Allow HTTP requests
change this to AssetId, not AssetType.
Although, why don’t you just do this?
clone.Image = "rbxthumb://type=".. v.Item.AssetType .."&id="..v.Item.AssetId .."&w=420&h=420"
The reason I dont do this is because the AssetType in the list I’m using is a number. If i run your code it will just do this:
clone.Image = "rbxthumb://type=GameIcon&id="..v.Item.AssetId .."&w=420&h=420"
or
clone.Image = "rbxthumb://type=GameThumbnail&id="..v.Item.AssetId .."&w=420&h=420"
Hey thanks for helping but like I said before, It has to be universal
maybe I wasn’t clear before: IM NOT JUST GETTING THEIR FAVORITE GAMES
I’m getting ALL their favorites (avatar items, games, etc)
Oh wait I’m seeing now, and I just realized that you weren’t the person I told that to previously to lol. Sorry if that came off as aggressive, It’s just I’m reexplaining it lol
Oh, yeah, that’s my bad. But, couldn’t you just get the assetType from the Enum AssetType list?
function getAssetType(assettype)
for i, v in ipairs(Enum.AssetType:GetEnumItems()) do
if assettype == v.Value then
return v.Name
end
end
end
--later in the code
clone.Image = "rbxthumb://type="..getAssetType(v.Item.AssetType).."&id="..v.Item.AssetId.."&w=420&h=420"
Also, it’s fine, I understand the pain of repeating yourself multiple times, typically worse for the same person lol
What are you trying to use this for? there might be an easier solution.
I’m looping through a players favorites and I’m creating an image label for each favorite. I’m then setting the image of the image to the favorited item that’s currently being looped. I already have a list of their favorites the problem is just setting the image to be that favorited item’s image
could you try printing this?
function getAssetType(assettype)
for i, v in ipairs(Enum.AssetType:GetEnumItems()) do
if assettype == v.Value then
return v.Name
end
end
end
---later again
print(getAssetType(v.Item.AssetType))
Oh hold on, hold on, I see the problem. AssetType also contains other things other than just what we wanted.
What other information does it give? I printed it and it gave me a valid name