So I am trying to make a catalog Gui but I am encountering crucial problem, I’ve written some code to list out all the accessories in a folder, which is located in ReplicatedStorage, and make them in the actual Gui. So basically the function gets all the Values in a specific folder, and their sub-values and then Clones a button template and adds in the correct ImageId, Name, etc. My problem is that the code itself works but the image fails to load in and when trying to buy the item itself it fails saying the item is not for sale when it clearly is(Item is from the Roblox catalog), and I do not know why.
My Code
for _, v in pairs(game.ReplicatedStorage.CatalogAssets.Accessories.Hats:GetChildren()) do
local templ = Template
templ.Name = v.ItemName.Value
templ.Image = tostring(v.ImageId)
templ.Parent = CatalogUI.List.Accessories
templ.ItemId.Value = v.ItemId.Value
-- Buy Accessory
templ.MouseButton1Click:Connect(function()
MarketPlace:PromptPurchase(Player, tonumber(templ.ItemId.Value))
end)
end
Not sure if you are using the AssetId of the product, but if you aren’t then thats the problem for the image not appearing, and most likely purchase failure.
It printed the correct imageId it but I still get this error. 16:32:49.466 Image https://assetdelivery.roblox.com/v1/asset?id=1052732853 failed to load. Error 403: Asset type does not match requested type
Did you upload it via Studio or add it via the Website > Create? I would advise using the Asset Manager in Studio. If it helps at all, it gives me exactly the same error whether added via code or manually in to an ImageButton: