codyorr4

NameTag Script

Oct 25th, 2020
1,136
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local overheadGui = script.headgui
  2.  
  3. local Players = game:GetService("Players")
  4.  
  5. local MainGroupId = 6619415
  6.  
  7. local Divisions = {
  8.     ["Class Disposable"] = {
  9.         ["Name"] = "Class Disposable",
  10.         ["GroupId"] = 6619415,
  11.         ["Rank"] = 1
  12.     },
  13.     ["O5-E"] = {
  14.         ["Name"] = "O5-E",
  15.         ["GroupId"] = 6619415,
  16.         ["Rank"] = 11
  17.     },
  18.     ["O5 Council"] = {
  19.         ["Name"] = "O5 Council Head",
  20.         ["GroupId"] = 6619415,
  21.         ["Rank"] = 10
  22.     },
  23.     ["Site Director"] = {
  24.         ["Name"] = "Site Director",
  25.         ["GroupId"] = 6619415,
  26.         ["Rank"] = 11
  27.     },
  28.     ["Manufacturing Department"] = {
  29.         ["Name"] = "Manufacturing Department",
  30.         ["GroupId"] = 6619415,
  31.         ["Rank"] = 254
  32.     },
  33.     ["Class-Exiled"] = {
  34.         ["Name"] = "Class-Exiled",
  35.         ["GroupId"] = 6619415,
  36.         ["Rank"] = 2
  37.     },
  38.     ["Level-0"] = {
  39.         ["Name"] = "Level-0",
  40.         ["GroupId"] = 6619415,
  41.         ["Rank"] = 3
  42.     },
  43.     ["Level-1"] = {
  44.         ["Name"] = "Level-1",
  45.         ["GroupId"] = 6619415,
  46.         ["Rank"] = 4
  47.     },
  48.     ["Level-2"] = {
  49.         ["Name"] = "Level-2",
  50.         ["GroupId"] = 6619415,
  51.         ["Rank"] = 5
  52.     },
  53.     ["Level-3"] = {
  54.         ["Name"] = "Level-3",
  55.         ["GroupId"] = 6619415,
  56.         ["Rank"] = 6
  57.     },
  58.     ["Level-4"] = {
  59.         ["Name"] = "Level-4",
  60.         ["GroupId"] = 6619415,
  61.         ["Rank"] = 7
  62.     },
  63.     ["Level-5"] = {
  64.         ["Name"] = "Level-5",
  65.         ["GroupId"] = 6619415,
  66.         ["Rank"] = 8
  67.     },
  68.     ["Department Director"] = {
  69.         ["Name"] = "Department Director",
  70.         ["GroupId"] = 6619415,
  71.         ["Rank"] = 10
  72.     },
  73.     ["Moderator"] = {
  74.         ["Name"] = "Moderation Team",
  75.         ["GroupId"] = 6619415,
  76.         ["Rank"] = 9
  77.  
  78.     }
  79. }
  80.  
  81. function RankCheck(Player, PlayerId)
  82.     local Division
  83.     local DivisionNickname
  84.     for i, v in pairs(Divisions) do
  85.         print(v["Rank"])
  86.         if Player:IsInGroup(v["GroupId"]) then
  87.             Division = v
  88.             DivisionNickname = v["Name"]
  89.             if Division ~= nil then
  90.                 if Division["Rank"] < v["Rank"] then
  91.                     Division = v
  92.                     DivisionNickname = v["Name"]
  93.                 end
  94.             end
  95.             if v["Rank"] == 11 then
  96.                 break
  97.             end
  98.         end
  99.     end
  100.     return DivisionNickname
  101. end
  102.  
  103. game.Players.PlayerAdded:Connect(function(Player, PlayerId)
  104.     PlayerId = Player.UserId
  105.     Player.CharacterAdded:connect(function(Character)
  106.         Character.Humanoid.DisplayDistanceType = "None"
  107.         Character.Humanoid.HealthDisplayType = "AlwaysOff"
  108.         local Division = RankCheck(Player, PlayerId)
  109.         local Level = Player:GetRoleInGroup(MainGroupId)
  110.         if Level == "Guest" then
  111.             Level = ("Class D"..PlayerId)
  112.         end
  113.  
  114.         if Division ~= nil then
  115.             if string.lower(string.sub(Division, 1, 3)) == "the" then
  116.                 Division = string.sub(Division, 4)
  117.             elseif string.lower(string.sub(Level, 1, 3)) == "the" then
  118.                 Level = string.sub(Level, 4)
  119.             end
  120.         end
  121.         local overhead = overheadGui:Clone()
  122.         if Division == nil then
  123.             overhead.Frame.Rank2.Text = (Level)
  124.         else
  125.             overhead.Frame.Rank.Text = (Level.." | "..Division)
  126.         end
  127.         if Division == "O5-E" then
  128.             overhead.Frame.Rank2.Text = "O5-E"
  129.         elseif Division == "Site Director" then
  130.             overhead.Frame.Rank2.Text = "Site Director"
  131.         elseif Division == "Class Disposable" then
  132.             overhead.Frame.Rank2.Text = "Class Disposable"
  133.         elseif Division == "Class-Disposable" then
  134.             overhead.Frame.Rank2.Text = "Class Disposable"
  135.         elseif Division == "Class-Exiled" then
  136.             overhead.Frame.Rank2.Text = "Class Exiled"
  137.         elseif Division == "Moderator" then
  138.             overhead.Frame.Rank2.Text = "Moderation Team"
  139.         elseif Division == "Department Director" then
  140.             overhead.Frame.Rank2.Text = "Department Director"
  141.         elseif Division == "Level-5" then
  142.             overhead.Frame.Rank2.Text = "Level 5"
  143.         elseif Division == "Level-4" then
  144.             overhead.Frame.Rank2.Text = "Level 4"
  145.         elseif Division == "Level-3" then
  146.             overhead.Frame.Rank2.Text = "Level 3"
  147.         elseif Division == "Level-2" then
  148.             overhead.Frame.Rank2.Text = "Level 2"
  149.         elseif Division == "Level-1" then
  150.             overhead.Frame.Rank2.Text = "Level 1"
  151.         elseif Division == "Level-0" then
  152.             overhead.Frame.Rank2.Text = "Level 0"
  153.         else
  154.             overhead.Frame.Player.Text = (Player.Name)
  155.         end
  156.         overhead.Frame.Rank.Text = (overhead.Frame.Rank2)
  157.         overhead.Parent = Character.Head
  158.     end)
  159. end)
RAW Paste Data