Advertisement
HowToRoblox

GamepassShopServer

Nov 25th, 2021
3,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local gamepassIDs = {
  2.     [25375907] = script:WaitForChild("Sword"),
  3.     [25375884] = script:WaitForChild("LaserGun"),
  4.     [25375939] = script:WaitForChild("GravityCoil"),
  5.     [25375958] = script:WaitForChild("SpeedCoil"),
  6. }
  7.  
  8. local mps = game:GetService("MarketplaceService")
  9.  
  10.  
  11. game.Players.PlayerAdded:Connect(function(p)
  12.  
  13.     for id, tool in pairs(gamepassIDs) do
  14.        
  15.         if mps:UserOwnsGamePassAsync(p.UserId, id) then
  16.            
  17.             tool:Clone().Parent = p.StarterGear
  18.             tool:Clone().Parent = p.Backpack
  19.         end
  20.     end
  21. end)
  22.  
  23.  
  24. mps.PromptGamePassPurchaseFinished:Connect(function(p, id, purchased)
  25.    
  26.     if purchased and gamepassIDs[id] then
  27.        
  28.         gamepassIDs[id]:Clone().Parent = p.StarterGear
  29.         gamepassIDs[id]:Clone().Parent = p.Backpack
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement