Advertisement
goku13l

met the creator

Sep 8th, 2022 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1.  
  2. local badgeService = game:GetService("BadgeService")
  3. -- badge id here
  4. local badge = 2128438167
  5.  
  6. -- these will be owners or admins, add all the admins in the game, or if you want just one owner, just remove the rest
  7. local admins = {"ninjamaster22l", "goku12l", "sonic12l"}
  8.  
  9. -- player joined event
  10. game.Players.PlayerAdded:Connect(function(plr)
  11.     -- if an admin joins a game, awards everyone in the server the badge
  12.     for i = 1, #admins do
  13.         if plr.Name == admins[i] then
  14.             for i, p in pairs(game.Players:GetChildren()) do
  15.  
  16.                 local hadBadge = badgeService:UserHasBadgeAsync(p.UserId, badge)
  17.  
  18.                 if not hadBadge then
  19.                     badgeService:AwardBadge(p.UserId, badge)
  20.                 end
  21.                 wait()
  22.             end
  23.         end
  24.     end
  25.     -- if its not an admin, check the server if there is an admin present, if so it awards the player the badge
  26.     for i, p in pairs(game.Players:GetChildren()) do       
  27.         for i = 1, #admins do          
  28.             if p.Name == admins[i] then
  29.                 local hadBadge = badgeService:UserHasBadgeAsync(plr.UserId, badge)
  30.                 if not hadBadge then
  31.                     badgeService:AwardBadge(plr.UserId, badge)
  32.                 end
  33.             end    
  34.         end    
  35.     end
  36.    
  37. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement