Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local BillboardGui = script:WaitForChild("RankGui")
  3.  
  4. local GroupService = game:GetService("GroupService")
  5.  
  6.  
  7.  
  8. function getrank(rankintvalue)
  9. if rankintvalue == nil or rankintvalue == 0 then
  10. return "Guest"
  11. end
  12. if rankintvalue == 1 then
  13. return "Force Sensitive"
  14. end
  15.  
  16. if rankintvalue == 3 then
  17. return "Jedi Youngling"
  18. end
  19. if rankintvalue == 4 then
  20. return "Initiate"
  21. end
  22. if rankintvalue == 5 then
  23. return "Padawan"
  24. end
  25. if rankintvalue == 7 then
  26. return "Jedi Knight"
  27. end
  28. if rankintvalue == 9 then
  29. return "Jedi Guardian"
  30. end
  31. if rankintvalue == 11 then
  32. return "Jedi Consular"
  33. end
  34.  
  35. if rankintvalue == 13 then
  36. return "Jedi Sentinel"
  37. end
  38.  
  39. if rankintvalue == 14 then
  40. return "Jedi Battle Master"
  41. end
  42.  
  43. if rankintvalue == 15 then
  44. return "Jedi Instructor"
  45. end
  46.  
  47. if rankintvalue == 17 then
  48. return "Jedi Master"
  49. end
  50.  
  51. if rankintvalue == 19 then
  52. return "Engineers"
  53. end
  54. if rankintvalue == 21 then
  55. return "Jedi Elder"
  56. end
  57. if rankintvalue == 23 then
  58. return "Jedi Council"
  59. end
  60. if rankintvalue == 255 then
  61. return "Grandmaster"
  62. end
  63.  
  64. end
  65.  
  66.  
  67.  
  68. local function groups(player)
  69. local del = player:FindFirstChild("leaderstats")
  70. if del then
  71. del:Destroy()
  72. end
  73. local success, erroestatment
  74. success= false
  75. while success == false do
  76. success, erroestatment = pcall(function()
  77.  
  78.  
  79. groupse = GroupService:GetGroupsAsync(player.UserId)
  80.  
  81.  
  82.  
  83. end)
  84. print(success)
  85. -- game.ReplicatedStorage.RemoteEvent:FireAllClients(success,erroestatment)
  86.  
  87. end
  88.  
  89. local role ,rank = nil
  90.  
  91. local count = 1
  92. while count < #groupse+1 do
  93. print(count)
  94. print(groupse[count])
  95.  
  96. for key, value in pairs(groupse[count]) do
  97.  
  98. if value == "{ The Jedi Order}" then
  99. role = value
  100. for key, value in pairs(groupse[count]) do
  101. if key == "Rank" then
  102. rank = value
  103. end
  104.  
  105.  
  106. end
  107.  
  108.  
  109.  
  110.  
  111.  
  112. end
  113.  
  114.  
  115. end
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. count = count+1
  123. end
  124.  
  125.  
  126.  
  127. print (role)
  128. print(rank)
  129.  
  130. local leaderstats = Instance.new("Model", player)
  131. leaderstats.Name = "leaderstats"
  132. leaderstats.Parent = player
  133. local grouprank = Instance.new("StringValue", leaderstats)
  134. grouprank.Name = "Rank"
  135. grouprank.Value = getrank(rank)
  136. ----------------------------
  137.  
  138. local grouprace = Instance.new("StringValue", leaderstats)
  139. grouprace.Name = "Race"
  140. grouprace.Value = "Unknown"
  141.  
  142.  
  143. print("done")
  144. if rank == nil then
  145. game.Players[tostring(player)].Team = game.Teams.Visitor
  146. end
  147. end
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156. -------------------------------------------------------------------------
  157.  
  158.  
  159.  
  160. local function OnPlayerAdded(Player)
  161. Player.CharacterAdded:Connect(function(Character)
  162.  
  163. groups(Player)
  164.  
  165. Player:WaitForChild("leaderstats")
  166. local rank = Player["leaderstats"]:WaitForChild("Rank")
  167. repeat wait() until Character:FindFirstChild("Humanoid") or Player.Character == nil
  168. if Character:FindFirstChild("Humanoid") then
  169. local clonedgui = BillboardGui:Clone()
  170. clonedgui.TextLabel.Text = rank.value
  171. clonedgui.TextLabel.TextStrokeColor3 = BrickColor.new("Deep orange").Color
  172. clonedgui.Parent = Character:WaitForChild("Head", 4)
  173. script.Parent.Parent:Fire(rank.value,Character["Head"])
  174. end
  175. end)
  176. end
  177.  
  178. for i,v in pairs(Players:GetPlayers()) do OnPlayerAdded(v) end
  179. game.Players.PlayerAdded:Connect(OnPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement