local ShopButton = script.Parent.ShopButton
local ShopFrame = script.Parent.ShopFrame
local ListFrame = ShopFrame.ListFrame
local player = game.Players.LocalPlayer
local MarketPlaceService = game:GetService("MarketplaceService")
ShopButton.MouseButton1Click:Connect(function()
if ShopFrame.Visible == false then
ShopFrame.Visible = true
else
ShopFrame.Visible = false
end
end)
for i, Button in pairs(ListFrame:GetChildren()) do
if Button:IsA("ImageButton") or Button:IsA("TextButton") then
Button.MouseButton1Click:Connect(function()
local GamepassID = Button:FindFirstChild("ID")
MarketPlaceService:PromptGamePassPurchase(player, GamepassID.Value)
end)
end
end