-
What do you want to achieve?
I want a script to get the IconImageAssetId of a gamepass and put it in an Image
-
What is the issue?
No Image appears
This is the gamepass: VIP - Roblox
local MarketplaceService = game:GetService("MarketplaceService")
local GamePassID = script.Parent.GamePassID.Value
local Asset = MarketplaceService:GetProductInfo(GamePassID)
script.Parent.ImageLabel.Image = "rbxassetid://"..Asset.IconImageAssetId
script.Parent.Title.Text = Asset.Name
I think it might be because it needs time to load?
But how to let it wait in the script without wait()
The output says that the AssetId is 0
You forgot to specify the InfoType
local MarketplaceService = game:GetService("MarketplaceService")
local GamePassID = script.Parent.Parent.GamePassID.Value
local Asset = MarketplaceService:GetProductInfo(GamePassID, Enum.InfoType.GamePass)
script.Parent.Image = "rbxassetid://"..Asset.IconImageAssetId
2 Likes
Thank you!
I just figured out that you can make new lines (<br>
in html) in TextLabels
when you take e.g. a description of a gamepass.
This is my updated script (the script is now in a different position)
local MarketplaceService = game:GetService("MarketplaceService")
local GamePassID = script.Parent.GamePassID.Value
local Asset = MarketplaceService:GetProductInfo(GamePassID, Enum.InfoType.GamePass)
script.Parent.ImageLabel.Image = "rbxassetid://"..Asset.IconImageAssetId
script.Parent.Title.Text = Asset.Name
script.Parent.TextButton.TextLabel.Text = Asset.PriceInRobux.." Robux"
script.Parent.Frame.TextLabel.Text = Asset.Description
How would I make it indicate whether the players owns the gamepass or not?