evasivedocs
Roblox scriptingLuau 0.748 · 24 guides · 385 API entries
Examples

Player list overlay

A small panel on the left of the Roblox window that lists everyone in the server, closest first, with their team, health and distance. It updates four times a second, which is plenty for a list and costs almost nothing.

It uses one multi-line Text drawing in a monospace font so the columns line up, on top of a dark rounded Square.

Luau
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

local X, Y, WIDTH = 16, 180, 330

local panel = Drawing.new("Square")
panel.Filled = true
panel.Color = Color3.fromRGB(16, 18, 24)
panel.Transparency = 0.75
panel.Corner = 8
panel.Position = Vector2.new(X, Y)
panel.Visible = true

local list = Drawing.new("Text")
list.Font = Drawing.Fonts.Monospace
list.FontSize = 13
list.Color = Color3.fromRGB(230, 232, 240)
list.Position = Vector2.new(X + 10, Y + 8)
list.Visible = true

local function myPosition()
    local character = LocalPlayer.Character
    local root = character and character:FindFirstChild("HumanoidRootPart")
    return root and root.Position
end

while true do
    local me = myPosition()
    local rows = {}
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= LocalPlayer then
            local character = player.Character
            local humanoid = character and character:FindFirstChildOfClass("Humanoid")
            local root = character and character:FindFirstChild("HumanoidRootPart")
            local distance = (me and root) and (root.Position - me).Magnitude or math.huge
            rows[#rows + 1] = {
                name = player.DisplayName,
                team = player.Team and player.Team.Name or "",
                health = humanoid and math.floor(humanoid.Health) or 0,
                distance = distance,
            }
        end
    end

    table.sort(rows, function(a, b)
        return a.distance < b.distance
    end)

    local lines = { string.format("%-16s %-10s %5s %6s", "Player", "Team", "HP", "Dist") }
    for i, row in ipairs(rows) do
        if i > 20 then
            lines[#lines + 1] = string.format("... and %d more", #rows - 20)
            break
        end
        local distance = row.distance == math.huge and "-" or tostring(math.floor(row.distance))
        lines[#lines + 1] = string.format("%-16s %-10s %5d %6s",
            row.name:sub(1, 16), row.team:sub(1, 10), row.health, distance)
    end

    list.Text = table.concat(lines, "\n")
    panel.Size = Vector2.new(WIDTH, #lines * 15 + 16)
    task.wait(0.25)
end

Things to change

  • X and Y move the panel. WIDTH and the * 15 line height go with FontSize = 13. Change them together.
  • Sort by health instead with return a.health < b.health.
  • To hide the panel while Roblox is not the window in front, set panel.Visible and list.Visible to isrbxactive() at the top of the loop.