Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)
- function getPlayersOnTeam(team)
- local ret = {}
- local pls = game:GetService("Players"):GetPlayers()
- for i,v in pairs(pls) do
- if v.TeamColor==team.TeamColor then
- table.insert(ret,v)
- end
- end
- return ret
- end
- function getNeutralPlayers()
- local ret = {}
- for i,v in pairs(game:GetService("Players"):GetPlayers()) do
- if v.Neutral==true then
- table.insert(ret,v)
- end
- end
- return ret
- end
- function getTeams()
- return game:GetService("Teams"):GetChildren()
- end
- function getPlayers()
- return game:GetService("Players"):GetPlayers()
- end
- function findFirstClass(obj,name)
- local e = obj:GetChildren()
- for i,v in pairs(e) do
- if v.className==name then return v end
- end
- return nil
- end
- local gui = Instance.new("ScreenGui",findFirstClass(game:GetService("Players").LocalPlayer,"PlayerGui"))
- local frame = Instance.new("Frame",gui)
- function refresh()
- frame:ClearAllChildren()
- local pls = getPlayers()
- local teams = getTeams()
- local size = #pls+#teams+3
- size = size*20
- local fontSize = Enum.FontSize.Size18
- frame.Size = UDim2.new(0,200,0,size)
- frame.Position = UDim2.new(1,-200,0,0)
- frame.BorderSizePixel = 0
- frame.BackgroundColor3 = Color3.new(128/255,128/255,128/255)
- frame.BackgroundTransparency = 0.4
- local tl = Instance.new("TextLabel",frame)
- tl.BorderSizePixel = 0
- tl.BackgroundTransparency = 1
- tl.TextColor3 = Color3.new(1,1,1)
- tl.Size = UDim2.new(1,0,0,20)
- tl.FontSize = fontSize
- tl.Text = "PlayerList"
- tl.TextXAlignment = Enum.TextXAlignment.Left
- if #teams==0 then
- for i=1,#pls do
- local yPos = i+1
- local tl = Instance.new("TextLabel",frame)
- tl.Position = UDim2.new(0,0,0,yPos*20)
- tl.Size = UDim2.new(1,0,0,20)
- tl.TextXAlignment = Enum.TextXAlignment.Left
- tl.TextColor3 = Color3.new(0,0,1)
- tl.BorderSizePixel = 0
- tl.BackgroundTransparency = 1
- tl.FontSize = Enum.FontSize.Size14
- tl.Text = pls[i].Name
- end
- end
- end
- refresh()
- function toggle(pl)
- refresh()
- end
- game:GetService("Players").PlayerAdded:connect(toggle)
- game:GetService("Players").PlayerRemoving:connect(toggle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement