> For the complete documentation index, see [llms.txt](https://synilla.gitbook.io/essentials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://synilla.gitbook.io/essentials/reference/functions/players/getnamefromuseridasync.md).

# GetNameFromUserIdAsync

This function returns the players username from the given userId.

**Example Usage:**

{% tabs %}
{% tab title="Script" %}

```lua
-- Getting ReplicatedStorage service
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Referencing Essentials
local Essentials = require(ReplicatedStorage.Essentials)

-- Creating a variable of the userId of the player we want to get the username of
local userId = 189051237

-- Getting the username from the userId given
Essentials.GetNameFromUserIdAsync(userId, true)
```

{% endtab %}

{% tab title="Output" %}

```
Success:
Essentials: The username of userId 189051237 is Femtrs

Failed:
Essentials: Failed to retrieve username from the assigned userId
```

{% endtab %}
{% endtabs %}

### Parameters

#### userId: [number](https://create.roblox.com/docs/luau/numbers)

The specified players userId.

<figure><img src="https://3651945002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKiSYJIqcES1NZgiCvXjM%2Fuploads%2FCKQC2tlQf2xWNi8pS7sj%2Frobloxuserid.png?alt=media&amp;token=3df84ed0-0c00-4bb1-8da6-20076752e936" alt=""><figcaption><p>How to retrieve the userId of a player via their Roblox Profile</p></figcaption></figure>

#### debugging: [bool](https://create.roblox.com/docs/luau/booleans)

Sends an output log to your output window and developer console.

### References

#### [Numbers](https://create.roblox.com/docs/luau/numbers)

#### [Players:GetNameFromUserIdAsync](https://create.roblox.com/docs/reference/engine/classes/Players#GetNameFromUserIdAsync)
