So, today I tried to make a gamepass store using a for loop. It will only add 1 out of all the cards in the table? Also the ImageID isn't loading for some reason.
EDIT: The Purchase Button doesn't work either.
CODE:
local gamepasses = {11409231, 11409235, 11409245, 11409250}
local ResourcesFolder = script.Resources
local Frame = ResourcesFolder.Frame
local MPlaceService = game:GetService("MarketplaceService")
local passesFrame = script.Parent.Gamepasses
-- Button // ISN'T FINISHED //
-- // THE FOR LOOP WHERE CODE ISN'T WORKING \\ --
-- Setting up the frames
function SetUp()
for i = 1, #gamepasses do
local gamepassID = gamepasses[i]
local passData = MPlaceService:GetProductInfo(gamepassID, Enum.InfoType.GamePass)
local name = passData.Name
local price = passData.PriceInRobux
local ImageId = "rbxassetid://"..passData.IconImageAssetId
local slot = Frame:Clone()
slot.Parent = passesFrame.ScrollingFrame
local image = slot.PassIcon
local priceLabel = slot.Price
local slotName = slot.Title
-- Enter info
slotName.Text = name
priceLabel.Text = "Robux: "..price
image = ImageId
slot.Purchase.MouseButton1Click:Connect(function()
MPlaceService:PromptGamePassPurchase(gamepassID)
end)
end
end
SetUp()
Thanks, Blxefirx/Blue

3 comments
Use an in pairs loop instead.
Is there a UI layout constraint inside the scrolling frame? Because youre not setting the position so it might only showing you the last one it created.
There is a list layout in the script.