Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ModulesFolder = ReplicatedStorage:WaitForChild("Modules")
- local GamepassIdModule = require(ModulesFolder:WaitForChild("GamepassIds"))
- local MarketPlaceService = game:GetService("MarketplaceService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local ShopFrame = script.Parent.GamepassFrame
- local ShopContainer = ShopFrame.ScrollingFrame
- local ShopButton = script.Parent.GamepassButton
- for _, v in pairs(GamepassIdModule) do
- local GamepassIdInfos = MarketPlaceService:GetProductInfo(v, Enum.InfoType.GamePass)
- local TemplateClone = ReplicatedStorage.Template:Clone()
- TemplateClone.Parent = ShopContainer
- TemplateClone.Visible = true
- TemplateClone.GamepassIcon.Image = "rbxassetid://"..GamepassIdInfos.IconImageAssetId
- TemplateClone.PurchaseButton.Text = GamepassIdInfos.PriceInRobux
- TemplateClone.RobuxIcon.Image = "rbxassetid://4625635722"
- if not MarketPlaceService:UserOwnsGamePassAsync(player.UserId, v) then
- TemplateClone.PurchaseButton.MouseButton1Click:Connect(function()
- MarketPlaceService:PromptGamePassPurchase(player, v)
- end)
- end
- MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(Player, GamepassId, Purchased)
- if GamepassId == v and Purchased then
- TemplateClone.PurchaseButton.Text = "OWNS"
- TemplateClone.RobuxIcon.Image = "rbxassetid://9207037475"
- end
- end)
- end
- ShopButton.MouseButton1Click:Connect(function()
- ShopFrame.Visible = not ShopFrame.Visible
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement