Advertisement
ieatgrass103

Player list prototype

Dec 12th, 2024 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.29 KB | None | 0 0
  1. --Variables--
  2. local updatetime = 3
  3. local players = game:GetService("Players")
  4. local placeholder = "rbxassetid://0"
  5. playeramount = 0
  6.  
  7. --Makes the part where everythings gona be--
  8. local mainpart = Instance.new("Part")
  9. mainpart.Parent = workspace
  10. mainpart.Name = "mainpart"
  11. mainpart.Size = Vector3.new(15, 10, 0.2)
  12. mainpart.CFrame = owner.Character.HumanoidRootPart.CFrame
  13. mainpart.Color = Color3.new(0.1, 0.1, 0.1)
  14. mainpart.Anchored = true
  15.  
  16. --Makes the screen where the text is gonna be
  17. local screen = Instance.new("SurfaceGui")
  18. screen.Name = "screen"
  19. screen.Parent = mainpart
  20. screen.Adornee = mainpart
  21.  
  22. --scrolly--
  23. local scrolly = Instance.new("ScrollingFrame")
  24. scrolly.Parent = screen
  25. scrolly.Size = UDim2.new(1, 0, 1, 0)
  26. scrolly.AutomaticCanvasSize = 3
  27. scrolly.BackgroundTransparency = 1
  28.  
  29. --Makes the player name--
  30. local function createlabel(plrname, plramount)
  31.     local label = Instance.new("TextLabel")
  32.     label.Parent = scrolly
  33.     label.Name = plrname
  34.     label.Size = UDim2.new(0.25, 0, 0.1, 0)
  35.     label.Text = plrname
  36.     label.Position = UDim2.new(0.15, 0, 0.1*(plramount-1))
  37.     label.TextScaled = true
  38.     label.BackgroundTransparency = 0.9
  39.     label.TextColor3 = Color3.new(0.85, 0.85, 0.85)
  40. end
  41. --fetches the account data(ripped this off of the forums cuz idk anything about os stuff)--
  42. local function getAccountDate(plr)
  43.     local ageSec = (plr.AccountAge)*86400
  44.     local createTime = os.time()-ageSec
  45.     local date = os.date("%x",createTime)
  46.     return tostring(date)
  47. end
  48. --makes the time labels--
  49. local function createtimelabel(plr, plramount)
  50.     local label = Instance.new("TextLabel")
  51.     label.Parent = scrolly
  52.     label.Name = "time "..plr.Name
  53.     label.Size = UDim2.new(0.15, 0, 0.1, 0)
  54.     label.Text = "Created on: "..getAccountDate(plr)
  55.     label.Position = UDim2.new(0.45, 0, 0.1*(plramount-1))
  56.     label.TextScaled = true
  57.     label.BackgroundTransparency = 0.9
  58.     label.TextColor3 = Color3.new(0.85, 0.85, 0.65)
  59. end
  60.  
  61. --Makes the profile image thingy--
  62. local function createprofile(plrname, plrid, plramount)
  63.     local label = Instance.new("ImageLabel")
  64.     label.Parent = scrolly
  65.     label.Name = plrname.."'s profile"
  66.     label.Image = players:GetUserThumbnailAsync(plrid, Enum.ThumbnailType.AvatarBust, Enum.ThumbnailSize.Size420x420)
  67.     label.Size = UDim2.new(0.1, 0, 0.1, 0)
  68.     label.Position = UDim2.new(0, 0, 0.1*(plramount-1))
  69.     local corner = Instance.new("UICorner")
  70.     corner.Parent = label
  71. end
  72.  
  73.  
  74. --Adds players who are in the server when the script is ran--
  75. for _, v in pairs(players:GetChildren()) do
  76.     createlabel(v.Name, _)
  77.     createprofile(v.Name, v.UserId, _)
  78.     createtimelabel(v, _)
  79.     playeramount = _ + 1
  80. end  
  81.  
  82. --Adds players who join the server after the script is ran--
  83. players.ChildAdded:Connect(function(plr)
  84.         createlabel(plr.Name, playeramount)
  85.         createprofile(plr.Name, plr.UserId, playeramount)
  86.         createtimelabel(plr, playeramount)
  87.         playeramount += 1
  88. end)
  89. --removes them when they leave--
  90. players.ChildRemoved:Connect(function(plr)
  91.         --wip gotta fix this
  92.         local plrname = plr.Name
  93.         scrolly:FindFirstChild(plrname.."'s profile"):Destroy()
  94.         scrolly:FindFirstChild("time "..plrname):Destroy()
  95.         scrolly:FindFirstChild(plrname):Destroy()
  96.         playeramount -= 1
  97. end)
  98.  
  99.  
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement