Skip to main content

PlayerUtils

Functions​

formatName​

PlayerUtils.formatName(player: Player) → string--

Formatted name

Human-readable version of a player name. If the player's name is the same as the display name, then returns that player's name. Otherwise returns a formatted name with the player's name like this "oot (@martxn)" which lets you know the username and the display name.

Note this is not localized, although most languages should be ok. Great for output for dev logs and command services which are less picky.

formatDisplayName​

PlayerUtils.formatDisplayName(
name: string,
displayName: string
) → string--

Formatted name

Human-readable version of a player name. If the player's name is the same as the display name, then returns that player's name. Otherwise returns a formatted name with the player's name like this "oot (@martxn)" which lets you know the username and the display name.

Note this is not localized, although most languages should be ok. Great for output for dev logs and command services which are less picky.

formatDisplayNameFromUserInfo​

PlayerUtils.formatDisplayNameFromUserInfo(userInfo: UserInfo) → string

Formats the display name from the user info

addVerifiedBadgeToName​

PlayerUtils.addVerifiedBadgeToName(name: string) → string

Adds verified badges to the name

getDefaultNameColor​

PlayerUtils.getDefaultNameColor(displayName: string) → Color3

Retrieves the display name color for a given player (for the Roblox chat)

promiseLoadCharacter​

PlayerUtils.promiseLoadCharacter(player: Player) → Promise<Model>

Calls :LoadCharacterAsync() in a promise

promiseLoadCharacterWithHumanoidDescription​

PlayerUtils.promiseLoadCharacterWithHumanoidDescription(
player: Player,
humanoidDescription: HumanoidDescription
) → Promise<Model>

Calls :LoadCharacterWithHumanoidDescriptionAsync() in a promise

Show raw api
{
    "functions": [
        {
            "name": "formatName",
            "desc": "Human-readable version of a player name. If the player's name is the same\nas the display name, then returns that player's name. Otherwise returns\na formatted name with the player's name like this \"oot (@martxn)\" which\nlets you know the username and the display name.\n\nNote this is not localized, although most languages should be ok. Great for\noutput for dev logs and command services which are less picky.",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "Formatted name",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 27,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "formatDisplayName",
            "desc": "Human-readable version of a player name. If the player's name is the same\nas the display name, then returns that player's name. Otherwise returns\na formatted name with the player's name like this \"oot (@martxn)\" which\nlets you know the username and the display name.\n\nNote this is not localized, although most languages should be ok. Great for\noutput for dev logs and command services which are less picky.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "displayName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Formatted name",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "formatDisplayNameFromUserInfo",
            "desc": "Formats the display name from the user info",
            "params": [
                {
                    "name": "userInfo",
                    "desc": "",
                    "lua_type": "UserInfo"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 68,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "addVerifiedBadgeToName",
            "desc": "Adds verified badges to the name",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 88,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "getDefaultNameColor",
            "desc": "Retrieves the display name color for a given player (for the Roblox chat)",
            "params": [
                {
                    "name": "displayName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Color3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 125,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "promiseLoadCharacter",
            "desc": "Calls :LoadCharacterAsync() in a promise",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<Model>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 135,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        },
        {
            "name": "promiseLoadCharacterWithHumanoidDescription",
            "desc": "Calls :LoadCharacterWithHumanoidDescriptionAsync() in a promise",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "humanoidDescription",
                    "desc": "",
                    "lua_type": "HumanoidDescription"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<Model>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 163,
                "path": "src/playerutils/src/Shared/PlayerUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PlayerUtils",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/playerutils/src/Shared/PlayerUtils.lua"
    }
}