Hello, so I have made the following code but Roblox keeps prompting me with this error message.
local marketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local productShop = script.Parent
local scrollingFrame = productShop:WaitForChild("ScrollingFrame")
local template = scrollingFrame:WaitForChild("Template")
local productIDS = {
1681205544,
}
local function PromptProduct(productID, buyButton)
marketplaceService:PromptGamePassPurchase(player, productID)
end
task.wait(3)
for _, productID in productIDS do
local productInfo = marketplaceService:GetProductInfo(productID, Enum.InfoType.Product)
local newTemplate = template:Clone()
newTemplate.Name = productInfo.Name
newTemplate.ImageLabel.Image = "rbxassetid://"..productInfo.IconImageAssetId
newTemplate.PriceLabel.Text = "R$"..productInfo.PriceInRobux
newTemplate.Visible = true
newTemplate.ID.Value = productID
newTemplate.Parent = scrollingFrame
newTemplate.BuyButton.MouseButton1Click:Connect(function()
PromptProduct(productID, newTemplate.BuyButton)
end)
end
How can I fix this?