HowToRoblox

GamepassShopClient

Nov 25th, 2021
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. local gamepassIDs = {25375907, 25375884, 25375939, 25375958}
  2.  
  3. local mps = game:GetService("MarketplaceService")
  4.  
  5.  
  6. script.Parent.Visible = false
  7.  
  8.  
  9. for i, id in pairs(gamepassIDs) do
  10.    
  11.     local frame = script.GamepassFrame:Clone()
  12.    
  13.     local info = mps:GetProductInfo(id, Enum.InfoType.GamePass)
  14.    
  15.     frame.GamepassName.Text = info.Name
  16.     frame.GamepassDescription.Text = info.Description
  17.     frame.GamepassPrice.Text = info.PriceInRobux .. " Robux"
  18.     frame.GamepassIcon.Image = "rbxassetid://" .. info.IconImageAssetId
  19.    
  20.     if not mps:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, id) then
  21.        
  22.         frame.BuyButton.MouseButton1Click:Connect(function()
  23.            
  24.             mps:PromptGamePassPurchase(game.Players.LocalPlayer, id)
  25.         end)
  26.        
  27.     else
  28.        
  29.         frame.BuyButton.Text = "Bought"
  30.         frame.BuyButton.BackgroundColor3 = Color3.fromRGB(3, 75, 0)
  31.         frame.BuyButton.UIStroke1.Color = Color3.fromRGB(2, 58, 0)
  32.         frame.BuyButton.UIStroke2.Color = Color3.fromRGB(2, 58, 0)
  33.     end
  34.    
  35.     frame.Parent = script.Parent.GamepassScroller
  36.    
  37.     script.Parent.GamepassScroller.CanvasSize = UDim2.new(0, 0, 0, script.Parent.GamepassScroller.UIListLayout.AbsoluteContentSize.Y)
  38. end
  39.  
  40.  
  41. script.Parent.CloseButton.MouseButton1Click:Connect(function()
  42.    
  43.     script.Parent.Visible = not script.Parent.Visible
  44. end)
  45.  
  46. script.Parent.Parent.GamepassShopButton.MouseButton1Click:Connect(function()
  47.    
  48.     script.Parent.Visible = not script.Parent.Visible
  49. end)
Add Comment
Please, Sign In to add comment