Advertisement
ttyyuu12345

Untitled

Mar 4th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)
  2. function getPlayersOnTeam(team)
  3. local ret = {}
  4. local pls = game:GetService("Players"):GetPlayers()
  5. for i,v in pairs(pls) do
  6. if v.TeamColor==team.TeamColor then
  7. table.insert(ret,v)
  8. end
  9. end
  10. return ret
  11. end
  12. function getNeutralPlayers()
  13. local ret = {}
  14. for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  15. if v.Neutral==true then
  16. table.insert(ret,v)
  17. end
  18. end
  19. return ret
  20. end
  21. function getTeams()
  22. return game:GetService("Teams"):GetChildren()
  23. end
  24. function getPlayers()
  25. return game:GetService("Players"):GetPlayers()
  26. end
  27. function findFirstClass(obj,name)
  28. local e = obj:GetChildren()
  29. for i,v in pairs(e) do
  30. if v.className==name then return v end
  31. end
  32. return nil
  33. end
  34. local gui = Instance.new("ScreenGui",findFirstClass(game:GetService("Players").LocalPlayer,"PlayerGui"))
  35. local frame = Instance.new("Frame",gui)
  36. function refresh()
  37. frame:ClearAllChildren()
  38. local pls = getPlayers()
  39. local teams = getTeams()
  40. local size = #pls+#teams+3
  41. size = size*20
  42. local fontSize = Enum.FontSize.Size18
  43. frame.Size = UDim2.new(0,200,0,size)
  44. frame.Position = UDim2.new(1,-200,0,0)
  45. frame.BorderSizePixel = 0
  46. frame.BackgroundColor3 = Color3.new(128/255,128/255,128/255)
  47. frame.BackgroundTransparency = 0.4
  48. local tl = Instance.new("TextLabel",frame)
  49. tl.BorderSizePixel = 0
  50. tl.BackgroundTransparency = 1
  51. tl.TextColor3 = Color3.new(1,1,1)
  52. tl.Size = UDim2.new(1,0,0,20)
  53. tl.FontSize = fontSize
  54. tl.Text = "PlayerList"
  55. tl.TextXAlignment = Enum.TextXAlignment.Left
  56. if #teams==0 then
  57. for i=1,#pls do
  58. local yPos = i+1
  59. local tl = Instance.new("TextLabel",frame)
  60. tl.Position = UDim2.new(0,0,0,yPos*20)
  61. tl.Size = UDim2.new(1,0,0,20)
  62. tl.TextXAlignment = Enum.TextXAlignment.Left
  63. tl.TextColor3 = Color3.new(0,0,1)
  64. tl.BorderSizePixel = 0
  65. tl.BackgroundTransparency = 1
  66. tl.FontSize = Enum.FontSize.Size14
  67. tl.Text = pls[i].Name
  68. end
  69. end
  70. end
  71. refresh()
  72. function toggle(pl)
  73. refresh()
  74. end
  75. game:GetService("Players").PlayerAdded:connect(toggle)
  76. game:GetService("Players").PlayerRemoving:connect(toggle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement