What is wrong with this script.
I have Clicktobuy folder on workspace and much clicktobuy models and in them there is part with surfacegui
for i,v in pairs(workspace.ClickTobuy:GetChildren()) do
local bundleId = v.Value.Value
local AssetService = game:GetService('AssetService')
local MarketplaceService = game:GetService('MarketplaceService')
local BundleItems = AssetService:GetBundleDetailsAsync(bundleId).Items
local FirstBundleInfo = MarketplaceService:GetProductInfo(BundleItems[1].Id)
local OldBundleId = string.match(FirstBundleInfo.Description, "%d+")
v.Part.SurfaceGui.TextButton.MouseButton1Down:Connect(function()
MarketplaceService:PromptPurchase(game.Players.LocalPlayer, bundleId)
end)
end
Edit:The error is
Internal error while fetching asset type because MarketplaceService:getProductInfo() failed because HTTP 400 (BadRequest)