Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2. local ts = game:GetService("Teams")
  3. local rep = game:GetService("ReplicatedStorage")
  4. local plrs = game:GetService("Players")
  5. local plrlc = script.Parent:WaitForChild("PlayerListContainer")
  6. local sf = plrlc:WaitForChild("ScrollingFrame")
  7. local ex = script.Parent:WaitForChild("Examples")
  8. local pex = ex:WaitForChild("Player")
  9. local tex = ex:WaitForChild("Team")
  10. local lplr = plrs.LocalPlayer
  11. local sg = game:GetService("StarterGui")
  12. local devs = {126451147}
  13. local owners = {}
  14. local icons = {
  15. ["Premium"] = "rbxasset://textures/ui/PlayerList/PremiumIcon.png",
  16. ["Dev"] = "rbxasset://textures/ui/PlayerList/OwnerIcon.png",
  17. ["Friend"] = "rbxasset://textures/ui/PlayerList/FriendIcon.png",
  18. ["RobloxAdmin"] = "rbxasset://textures/ui/PlayerList/AdminIcon.png",
  19. ["Star"] = "rbxasset://textures/ui/icon_star-16.png",
  20. ["Intern"] = "rbxasset://textures/ui/icon_intern-16.png",
  21. ["Owner"] = "rbxasset://textures/ui/icon_placeowner.png",
  22. ["Blocked"] = "rbxasset://textures/ui/PlayerList/BlockedIcon.png",
  23. ["Following"] = "rbxasset://textures/ui/PlayerList/FollowingIcon.png"
  24. }
  25.  
  26. repeat wait() until game:IsLoaded()
  27.  
  28. function getTeams()
  29. local teams = ts:GetTeams()
  30. table.sort(teams, function(a,b)
  31. return a.Name > b.Name
  32. end)
  33. return teams
  34. end
  35.  
  36. function sort(teams,ct)
  37. table.sort(teams, function(a,b)
  38. return a.Name > b.Name
  39. end)
  40. local rt = {}
  41. local co = 0
  42. for a,b in pairs(teams) do
  43. if b ~= ct then
  44. co = co + 1
  45. end
  46. end
  47. for k,team in pairs(teams) do
  48. if k < co then
  49. table.insert(rt,team)
  50. end
  51. end
  52. return teams
  53. end
  54.  
  55. function getOffset(teamC)
  56. local offset = 0
  57. local teams = sort(sf:GetChildren(),teamC)
  58. for _,team in pairs(teams) do
  59. if team ~= teamC then
  60. for _,ti in pairs(team:GetChildren()) do
  61. if ti:IsA("ImageLabel") or ti:IsA("Frame") then
  62. offset = offset + ti.Size.Y.Offset
  63. end
  64. end
  65. end
  66. end
  67. return offset
  68. end
  69.  
  70. function getPlayers(teamC,team)
  71. for _,plr in pairs(team:GetPlayers()) do
  72. if not teamC:FindFirstChild(plr.Name) then
  73. local pc = pex:Clone()
  74. pc.Name = plr.Name
  75. local txtbtn = pc:WaitForChild("TextButton")
  76. txtbtn.Text = plr.Name
  77. pc.Parent = teamC
  78. pc.Visible = true
  79. end
  80. end
  81. return true
  82. end
  83.  
  84. function update()
  85. for _,team in pairs(getTeams()) do
  86. if not sf:FindFirstChild(team.Name) then
  87. local tc = tex:Clone()
  88. local tm = tc:WaitForChild("!TeamName")
  89. local i = tm:WaitForChild("Image")
  90. local txt = tm:WaitForChild("TextLabel")
  91. tc.Name = team.Name
  92. i.ImageColor3 = team.TeamColor.Color
  93. txt.Text = team.Name
  94. local gpf = getPlayers(tc,team)
  95. repeat wait() until gpf == true
  96. tc.Position = UDim2.new(0,25,0,getOffset(tc))
  97. tc.Parent = sf
  98. tc.Visible = true
  99. else
  100. local t = sf:FindFirstChild(team.Name)
  101. local gpf = getPlayers(t,team)
  102. repeat wait() until gpf == true
  103. t.Position = UDim2.new(0,25,0,getOffset(t))
  104. end
  105. for _,teaml in pairs(sf:GetChildren()) do
  106. if not ts:FindFirstChild(teaml.Name) then
  107. teaml:Destroy()
  108. end
  109. end
  110. end
  111. end
  112.  
  113. plrs.PlayerAdded:Connect(update)
  114. plrs.PlayerRemoving:Connect(update)
  115. ts.ChildAdded:Connect(update)
  116. ts.ChildRemoved:Connect(update)
  117. wait()
  118. update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement