> ## Documentation Index
> Fetch the complete documentation index at: https://docs.selvut.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Status HUD

> A small HUD element rendered from a script.

Save as `status_hud.lua`.

```lua theme={null}
Script.meta({
  name = "Status HUD",
  description = "Shows FPS, TPS, and current player state."
})

local textColor
local background
local showWynnStats

local function positionText()
  local x = math.floor(Player.getX() or 0)
  local y = math.floor(Player.getY() or 0)
  local z = math.floor(Player.getZ() or 0)
  return "XYZ " .. x .. ", " .. y .. ", " .. z
end

local function statusText()
  if showWynnStats.get() then
    local health = Wynn.health()
    local mana = Wynn.mana()
    if health ~= nil and mana ~= nil then
      return "HP " .. health.current .. "/" .. health.max .. " | Mana " .. mana.current .. "/" .. mana.max
    end
  end
  return positionText()
end

local hud = Hud.createElement("Status HUD", {
  x = 8,
  y = 8,
  width = 150,
  height = 34,
  anchor = "top_left",
  render = function(event)
    Render.roundedRect(event.x, event.y, event.width, event.height, 4, background.get())
    Render.text("FPS " .. Client.fps() .. " | TPS " .. string.format("%.1f", Client.tps()), event.x + 5, event.y + 5, textColor.get(), true)
    Render.text(statusText(), event.x + 5, event.y + 18, textColor.get(), true)
  end
})

local hudSettings = hud.settings
textColor = hudSettings.color("Text Color", {
  default = Color.rgb(240, 244, 248)
})
background = hudSettings.color("Background", {
  default = Color.rgba(12, 18, 28, 155)
})
showWynnStats = hudSettings.bool("Show Wynn Stats", {
  default = true
})
```

The HUD element is removed automatically when the script unloads.
