Advertisement
4zx16

GUI Purchase Handler (Gamepass)

Nov 12th, 2021 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. --[[
  2.  || 📜 AUTHOR: @4zx16 || GAMEPASS GUI PURCHASE HANDLER || SELL GUIs USING GAMEPASSES.
  3. ]]
  4. local MPS = game:GetService("MarketplaceService")
  5. local plr = game:GetService("Players").LocalPlayer
  6. local event = game:GetService("ReplicatedStorage").GUI
  7. local id = 0
  8.  
  9. local function HandlePurchase()
  10.     if MPS:UserOwnsGamePassAsync(plr.UserId, id) then
  11.         wait(1)
  12.         event:FireServer()
  13.     else
  14.         MPS:PromptGamePassPurchase(plr, id)
  15.     end
  16. end
  17. script.Parent.MouseButton1Click:Connect(HandlePurchase)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement