I’m trying to get a gamepass price and then show it with a text box on a GUI. The gamepass ID are stocked in a table, loaded from Data Stores Services.
The method used to get the price is MarketService:GetProductInfo().
Howewer, keep having this issue.
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,tipsID)
local TipsList = TipsStore:GetAsync(plr.UserId) or {}
table.insert(TipsList,tonumber(tipsID))
TipsStore:SetAsync(plr.UserId, TipsList)
for _,a in pairs(script.Parent.Parent.TipListing:GetChildren()) do
if a.ClassName ~= "UIGridLayout" then
a:Destroy()
end
end
if TipsList ~= {} then
for i,v in pairs(TipsList) do
local product = MarketService:GetProductInfo(tonumber(v), Enum.InfoType.GamePass)
local Price = product.PriceInRobux
local Tip = script.Parent.Parent.Template:Clone()
Tip.Parent = script.Parent.Parent.TipListing
Tip.Name = v
Tip.Price.Text = v.." - $"..Price
Tip.Visible = true
end
end
end)
That error means the asset ID being used as an argument for the GetProductInfo method is either invalid or does not exist, so I suggest printing v in-order to confirm that the value is correct by manually going to the asset’s page
Remember that the tonumber function returns nil if it wasn’t able to convert the value provided into a number. If v isn’t formatted like shown in these examples:
“123”
“456.789”
then nil will be returned. If v is formatted correctly but the error is still occurring, then it might indicate that the gamepass was moderated. You can verify this by attempting to go to the gamepass’ page
It seems to be fixed.
Apparently, the ID it was looking for was a gamepass, but it seems that’s I’ve added an extra number without noticing
Resetting my data store key and readding gamepass IDs and it was reworking.