Trying to make a buy coins GUI and the button for different products is showing the last ID and isn’t showing any others… Also it isn’t showing the name of the product only the ID of the product.
Code
local DevProducts = {1230421676, 1230421820, 1230421884, 1230421918}
local Player = game.Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")
local ProductFrame = script.Parent.DonateFrame
local SampleButton = ProductFrame.SampleButton
function setupProducts()
for i = 1, #DevProducts do
local ProductsId = DevProducts[i]
local ProductData = MarketplaceService:GetProductInfo(ProductsId, Enum.InfoType.Product)
local ProductPrice = ProductData.PriceInRobux
local ProductSlot = SampleButton:Clone()
local PurchaseButton = ProductSlot
ProductSlot.Parent = ProductFrame
ProductSlot.Name = ProductsId
local ProductName = ProductSlot.Name
PurchaseButton.Text = "Buy " .. ProductName .. "for" .. ProductPrice .. "R$"
PurchaseButton.MouseButton1Click:Connect(function()
MarketplaceService:PromptGamePassPurchase(Player, ProductsId)
end)
end
SampleButton:Destroy()
end
setupProducts()