ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. setNametagsEnabled

Function

setNametagsEnabled

ClientMiscellaneousTrilogy Hub only

Turns the built-in nametags above other players' heads on or off for the local player. A shortcut for setNametagStyle({ enabled = ... }); useful when a resource draws its own nametags.

Syntax

bool setNametagsEnabled(bool enabled)

Arguments

enabledbool
false hides the built-in nametags.

Returns

true on success.

Example

setNametagsEnabled(false)
addEventHandler("onClientRender", root, function()
    for _, player in ipairs(getElementsByType("player", root, true)) do
        if player ~= localPlayer then
            local x, y, z = getElementPosition(player)
            local sx, sy = getScreenFromWorldPosition(x, y, z + 1.1)
            if sx then dxDrawText(getPlayerName(player), sx, sy) end
        end
    end
end)

See also