# GetUserIdFromNameAsync

**Example Usage:**

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

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

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

-- On the player added event, we created a function that gets the userId of the player when they join the experience
Players.PlayerAdded:Connect(function(player: Player)
    Essentials.GetUserIdFromNameAsync(player, true)
end)
```

{% endtab %}

{% tab title="Output" %}

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

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

{% endtab %}
{% endtabs %}

### Parameters

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

The specified player object.

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

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

### References

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

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

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