local Gamepass = game.ReplicatedStorage.Gamepasses:GetChildren() ---- folder para ImageButton or Tools con ID (NumberValue or IntValue)
local Info = script.Parent.Parent.Info
local player = game.Players.LocalPlayer
local MPS = game:GetService("MarketplaceService")
for v1, v2 in pairs(Gamepass) do
spawn(function()
local GamepassInfo = MPS:GetProductInfo(v2.ID.Value, Enum.InfoType.GamePass)
local v3 = script:FindFirstChild("ImageButton"):Clone()
v3.Name = v2.Name
v3.Image = v2.Image
v3.Parent = script.Parent
local v1 = v2
local function v6()
if Info.ViewportFrame:FindFirstChild(v3.Name) == nil then
Info.ViewportFrame:ClearAllChildren()
Info.BuyButton.Visible = true
Info.BuyButton.Text = "BUY"
Info.nameLabel.Text = GamepassInfo.Name
Info.ViewportFrame.Image = v2.Image
Info.Description.Text = GamepassInfo.Description
Info.Price.Text = GamepassInfo.PriceInRobux.." Robux"
Info.Viewing.Value = v3.Name
Info.BuyButton.MouseButton1Click:Connect(function()
MPS:PromptGamePassPurchase(player, v1.ID.Value)
MPS.PromptGamePassPurchaseFinished:Connect(function(Player, GamepassId, Purchased)
if GamepassId == v1.ID.Value and Purchased then
Info.BuyButton.Text = "OWNS"
end
end)
end)
end
end
v3.MouseButton1Click:Connect(v6)
v3.SelectionGained:Connect(v6)
end)
end
while true do
script.Parent.CanvasSize = UDim2.new(0, 0, 0, script.Parent.UIGridLayout.AbsoluteContentSize.Y)
wait()
end