0% found this document useful (0 votes)
1 views2 pages

Message

The document is a Lua script for a custom player list UI in a game, designed to replace the default player list with a more compact version. It creates a scrolling frame that displays player names, sorted by team and display name, and includes functionality to show or hide the list using the Tab key. The script also handles player addition and removal, updating the list dynamically as players join or leave the game.

Uploaded by

dubazz4ikkr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views2 pages

Message

The document is a Lua script for a custom player list UI in a game, designed to replace the default player list with a more compact version. It creates a scrolling frame that displays player names, sorted by team and display name, and includes functionality to show or hide the list using the Tab key. The script also handles player addition and removal, updating the list dynamically as players join or leave the game.

Uploaded by

dubazz4ikkr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- Compact Custom PlayerList on Tab (~55 lines)

local Players=game:GetService("Players")
local StarterGui=game:GetService("StarterGui")
local CAS=game:GetService("ContextActionService")
local UIS=game:GetService("UserInputService")
local TS=game:GetService("TweenService")
local LP=Players.LocalPlayer
pcall(function() StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)
end)

local gui=Instance.new("ScreenGui"); gui.ResetOnSpawn=false;


gui.IgnoreGuiInset=true; gui.Name="TabList";
gui.Parent=LP:WaitForChild("PlayerGui")
local panel=Instance.new("Frame"); panel.Size=UDim2.new(0,300,0,380);
panel.Position=UDim2.new(1,-12,0,12); panel.AnchorPoint=Vector2.new(1,0)
panel.BackgroundColor3=Color3.fromRGB(18,18,22); panel.BackgroundTransparency=.08;
panel.Visible=false; panel.Parent=gui
Instance.new("UICorner",panel).CornerRadius=UDim.new(0,10)

local title=Instance.new("TextLabel"); title.BackgroundTransparency=1;


title.Font=Enum.Font.GothamSemibold; title.TextSize=20
title.TextColor3=Color3.fromRGB(235,235,245);
title.TextXAlignment=Enum.TextXAlignment.Left
title.Size=UDim2.new(1,-20,0,32); title.Position=UDim2.new(0,10,0,10);
title.Text="Игроки"; title.Parent=panel
local sep=Instance.new("Frame"); sep.BackgroundTransparency=.9;
sep.BorderSizePixel=0; sep.Size=UDim2.new(1,-20,0,1);
sep.Position=UDim2.new(0,10,0,46); sep.Parent=panel

local scroll=Instance.new("ScrollingFrame"); scroll.BackgroundTransparency=1;


scroll.ScrollBarThickness=6
scroll.Size=UDim2.new(1,-20,1,-60); scroll.Position=UDim2.new(0,10,0,52);
scroll.CanvasSize=UDim2.new(); scroll.Parent=panel
local layout=Instance.new("UIListLayout",scroll); layout.Padding=UDim.new(0,6);
layout.SortOrder=Enum.SortOrder.LayoutOrder
local pad=Instance.new("UIPadding",scroll); pad.PaddingTop=UDim.new(0,4);
pad.PaddingLeft=UDim.new(0,2); pad.PaddingRight=UDim.new(0,2)

local function nameFor(p) return (p.DisplayName~=p.Name) and (p.DisplayName.."


(@"..p.Name..")") or p.Name end
local function rowFor(p,order)
local r=Instance.new("TextLabel"); r.Name="row_"..p.UserId;
r.LayoutOrder=order
r.BackgroundColor3=Color3.fromRGB(26,26,32); r.BorderSizePixel=0;
r.Size=UDim2.new(1,0,0,32)
r.TextXAlignment=Enum.TextXAlignment.Left; r.Font=Enum.Font.Gotham;
r.TextSize=16; r.TextColor3=Color3.fromRGB(230,230,240)
r.Text=((p==LP) and "★ " or "")..nameFor(p); r.Parent=scroll;
Instance.new("UICorner",r).CornerRadius=UDim.new(0,6)
return r
end

local function canvas()


scroll.CanvasSize=UDim2.new(0,0,0,layout.AbsoluteContentSize.Y+6) end
layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(canvas)

local conns={}
local function clearCons() for _,c in ipairs(conns) do pcall(function()
c:Disconnect() end) end conns={} end
local function rebuild()
for _,ch in ipairs(scroll:GetChildren()) do if ch:IsA("TextLabel") then
ch:Destroy() end end
clearCons()
local list=Players:GetPlayers()
table.sort(list,function(a,b)
local ta=a.Team and a.Team.Name or ""; local tb=b.Team and b.Team.Name
or ""
if ta==tb then return string.lower(a.DisplayName or
a.Name)<string.lower(b.DisplayName or b.Name) else return ta<tb end
end)
for i,p in ipairs(list) do rowFor(p,i); table.insert(conns,
p:GetPropertyChangedSignal("DisplayName"):Connect(rebuild)) end
title.Text=("Игроки ("..tostring(#list)..")"); canvas()
end

Players.PlayerAdded:Connect(rebuild); Players.PlayerRemoving:Connect(rebuild);
rebuild()

local open=false
local function show() if open then return end open=true panel.Visible=true
panel.Position=UDim2.new(1,-12,0,-8)
local
t=TS:Create(panel,TweenInfo.new(.12,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
,{Position=UDim2.new(1,-12,0,12)}); t:Play() end
local function hide() if not open then return end open=false
local
t=TS:Create(panel,TweenInfo.new(.12,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
,{Position=UDim2.new(1,-12,0,-8)})
t.Completed:Connect(function() if not open then panel.Visible=false end end);
t:Play()
end
local function toggle() if open then hide() else show() end end

CAS:BindActionAtPriority("ToggleTabList",function(_,state)
if state==Enum.UserInputState.Begin then if UIS:GetFocusedTextBox() then
return Enum.ContextActionResult.Pass end toggle() end
return Enum.ContextActionResult.Sink
end,false,Enum.ContextActionPriority.High.Value,Enum.KeyCode.Tab)

LP.CharacterAdded:Connect(hide)

You might also like