Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local uis = game:GetService("UserInputService")
- local ts = game:GetService("Teams")
- local rep = game:GetService("ReplicatedStorage")
- local plrs = game:GetService("Players")
- local plrlc = script.Parent:WaitForChild("PlayerListContainer")
- local sf = plrlc:WaitForChild("ScrollingFrame")
- local ex = script.Parent:WaitForChild("Examples")
- local pex = ex:WaitForChild("Player")
- local tex = ex:WaitForChild("Team")
- local lplr = plrs.LocalPlayer
- local sg = game:GetService("StarterGui")
- local devs = {126451147}
- local owners = {}
- local icons = {
- ["Premium"] = "rbxasset://textures/ui/PlayerList/PremiumIcon.png",
- ["Dev"] = "rbxasset://textures/ui/PlayerList/OwnerIcon.png",
- ["Friend"] = "rbxasset://textures/ui/PlayerList/FriendIcon.png",
- ["RobloxAdmin"] = "rbxasset://textures/ui/PlayerList/AdminIcon.png",
- ["Star"] = "rbxasset://textures/ui/icon_star-16.png",
- ["Intern"] = "rbxasset://textures/ui/icon_intern-16.png",
- ["Owner"] = "rbxasset://textures/ui/icon_placeowner.png",
- ["Blocked"] = "rbxasset://textures/ui/PlayerList/BlockedIcon.png",
- ["Following"] = "rbxasset://textures/ui/PlayerList/FollowingIcon.png"
- }
- repeat wait() until game:IsLoaded()
- function getTeams()
- local teams = ts:GetTeams()
- table.sort(teams, function(a,b)
- return a.Name > b.Name
- end)
- return teams
- end
- function sort(teams,ct)
- table.sort(teams, function(a,b)
- return a.Name > b.Name
- end)
- local rt = {}
- local co = 0
- for a,b in pairs(teams) do
- if b ~= ct then
- co = co + 1
- end
- end
- for k,team in pairs(teams) do
- if k < co then
- table.insert(rt,team)
- end
- end
- return teams
- end
- function getOffset(teamC)
- local offset = 0
- local teams = sort(sf:GetChildren(),teamC)
- for _,team in pairs(teams) do
- if team ~= teamC then
- for _,ti in pairs(team:GetChildren()) do
- if ti:IsA("ImageLabel") or ti:IsA("Frame") then
- offset = offset + ti.Size.Y.Offset
- end
- end
- end
- end
- return offset
- end
- function getPlayers(teamC,team)
- for _,plr in pairs(team:GetPlayers()) do
- if not teamC:FindFirstChild(plr.Name) then
- local pc = pex:Clone()
- pc.Name = plr.Name
- local txtbtn = pc:WaitForChild("TextButton")
- txtbtn.Text = plr.Name
- pc.Parent = teamC
- pc.Visible = true
- end
- end
- return true
- end
- function update()
- for _,team in pairs(getTeams()) do
- if not sf:FindFirstChild(team.Name) then
- local tc = tex:Clone()
- local tm = tc:WaitForChild("!TeamName")
- local i = tm:WaitForChild("Image")
- local txt = tm:WaitForChild("TextLabel")
- tc.Name = team.Name
- i.ImageColor3 = team.TeamColor.Color
- txt.Text = team.Name
- local gpf = getPlayers(tc,team)
- repeat wait() until gpf == true
- tc.Position = UDim2.new(0,25,0,getOffset(tc))
- tc.Parent = sf
- tc.Visible = true
- else
- local t = sf:FindFirstChild(team.Name)
- local gpf = getPlayers(t,team)
- repeat wait() until gpf == true
- t.Position = UDim2.new(0,25,0,getOffset(t))
- end
- for _,teaml in pairs(sf:GetChildren()) do
- if not ts:FindFirstChild(teaml.Name) then
- teaml:Destroy()
- end
- end
- end
- end
- plrs.PlayerAdded:Connect(update)
- plrs.PlayerRemoving:Connect(update)
- ts.ChildAdded:Connect(update)
- ts.ChildRemoved:Connect(update)
- wait()
- update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement