Advertisement
Joriangames

Create Gamepass on Roblox

Mar 31st, 2023
909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. --[[
  2. Thanks for using this script
  3. Want to know how to use this and script explanation?
  4. Check the video here: https://youtu.be/pMFiBFOLSXA
  5. ]]
  6. local passId = 155644432
  7.  
  8. function createLabel(player)
  9.     local gui = Instance.new("ScreenGui")
  10.     gui.Name = "passUI"
  11.     gui.ResetOnSpawn = false
  12.    
  13.     local frame = Instance.new("Frame", gui)
  14.     frame.AnchorPoint = Vector2.new(0.5,0)
  15.     frame.Position = UDim2.new(0.5,0,0,0)
  16.     frame.Size = UDim2.new(0.5,0,0.2,0)
  17.    
  18.     local label = Instance.new("TextLabel", frame)
  19.     label.Text = "You own the gamepass!"
  20.     label.Size = UDim2.new(1,0,1,0)
  21.     label.TextXAlignment = 2 --2 means center
  22.    
  23.     return gui
  24. end
  25.  
  26. game.Players.PlayerAdded:Connect(function(plr)
  27.     local checkPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, passId)
  28.        
  29.     if checkPass then
  30.             print("user owns gamepass")
  31.             local UI = createLabel(plr)
  32.             UI.Parent = plr.PlayerGui
  33.     end
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement