Advertisement
HurricaneYT

GamePass Giver

Mar 31st, 2020
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. local Lighting = game:GetService("Lighting")
  2. local MarketplaceService = game:GetService("MarketplaceService")
  3. local Players = game:GetService("Players")
  4.  
  5. local gamepassId = 00000 --Put the ID of the asset here
  6. local toolNames = {"Potion"} --Must be in lighting --Name Of Item
  7. local toolsParent = Lighting
  8.  
  9. local function onPlayerAdded(player)
  10. local function onCharacterAdded(character)
  11. if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId) then
  12. for i = 1, #toolNames do
  13. local tool = toolsParent:FindFirstChild(toolNames[i])
  14. if tool then
  15. local clone = tool:Clone()
  16. clone.Parent = player.Backpack
  17. end
  18. end
  19. end
  20. end
  21.  
  22. if player.Character then
  23. onCharacterAdded(player.Character)
  24. end
  25. player.CharacterAdded:Connect(onCharacterAdded)
  26. end
  27.  
  28. Players.PlayerAdded:Connect(onPlayerAdded)
  29.  
  30. --Credit:Dev_LandonRB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement