HowToRoblox

PlayerListHandler

Mar 19th, 2020
3,396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
  2.  
  3.  
  4. local plrs = game.Players
  5.  
  6. local serverMax = plrs.MaxPlayers
  7.  
  8.  
  9. local template = game.ReplicatedStorage.Template
  10.  
  11. local list = script.Parent.List
  12.  
  13.  
  14. for i = 0, serverMax do
  15.    
  16.    
  17.     local label = template:Clone()
  18.    
  19.     label.Name = i
  20.    
  21.     label.Position = UDim2.new(0.027, 0, i * template.Size.Y.Scale, 0)
  22.     label.Parent = list
  23. end
  24.  
  25.  
  26. while wait() do
  27.    
  28.    
  29.     for i, label in pairs(list:GetChildren()) do
  30.        
  31.        
  32.         if plrs:GetChildren()[i] then
  33.            
  34.            
  35.             label.Text = plrs:GetChildren()[i].Name
  36.            
  37.         else
  38.            
  39.             label.Text = ""
  40.         end
  41.     end
  42. end
Add Comment
Please, Sign In to add comment