Advertisement
Guest User

my script

a guest
Jul 20th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | None | 0 0
  1. -- a script that awards badges
  2. local badgedata = -- data used to announce a badge win via ReplicateChat
  3. -- format: {badge id, boolean always announce, message, color3, font, fontsize}
  4. {
  5.     {434339420, true, " has joined the suffering", Color3.fromRGB(120,244,18),Enum.Font.Arcade, Enum.FontSize.Size28};
  6.     {719887787, false, " touched the sky, came up on the spot looking extra fly", Color3.fromRGB(244,168,241),Enum.Font.SciFi, Enum.FontSize.Size24};
  7.     {852913895, true, "'s lightning was reflected by the franklin badge!", Color3.fromRGB(0,0,0),Enum.Font.SourceSansLight, Enum.FontSize.Size28};
  8.     {731681677, true, " has committed at least 8 war crimes by now", Color3.fromRGB(255,0,0),Enum.Font.SciFi, Enum.FontSize.Size24};
  9.     {2108067336, false, " committed die for the first time", Color3.fromRGB(255,179,55),Enum.Font.Cartoon, Enum.FontSize.Size28};
  10. }
  11.  
  12.  
  13.  
  14.  
  15. function getBadgeData(badgeID)
  16.     for i,v in ipairs(badgedata) do
  17.         if v[1] == badgeID then
  18.             return v
  19.         end
  20.     end
  21.     return nil
  22. end
  23.  
  24. function invoked (player, badgeID)
  25.     print(player.Name)
  26.     print("badge is " .. badgeID .. "")
  27.     local badgeService = game:GetService("BadgeService")
  28.     local data = getBadgeData(badgeID)
  29.    
  30.     if badgeID == 434339420 then
  31.         local admins = {"lagio2", "astrain1", "samiam2001", "completely_useless"}
  32.        
  33.         for _,v in pairs(admins) do
  34.             if string.lower(player.Name) == v then
  35.                 return
  36.             end
  37.         end
  38.     end
  39.    
  40.     if not data then
  41.         if game.BadgeService:UserHasBadgeAsync(player.UserId, badgeID) == false then
  42.             badgeService:AwardBadge(player.userId, badgeID)
  43.         end
  44.     elseif data then
  45.         local msg = player.Name .. data[3]
  46.         if game.BadgeService:UserHasBadgeAsync(player.UserId, badgeID) == true and data[2] == true then
  47.             game.ReplicatedStorage.SendChatMessage:FireAllClients(msg, data[4], data[5], data[6])
  48.         elseif game.BadgeService:UserHasBadgeAsync(player.UserId, badgeID) == false then
  49.             game.ReplicatedStorage.SendChatMessage:FireAllClients(msg, data[4], data[5], data[6])
  50.             badgeService:AwardBadge(player.userId, badgeID)
  51.         end
  52.     end
  53. end
  54.  
  55. game.ServerStorage.GiveBadge.Event:connect(invoked)
  56.  
  57. function onEntered(player)
  58.     wait(1)
  59.     game.ServerStorage.GiveBadge:Fire(player, 434339420)
  60. end
  61.  
  62. game.Players.PlayerAdded:connect(onEntered)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement