GetUserIdFromNameAsync
This function returns the players userId from the given username.
-- 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)Success:
Essentials: The userId of Femtrs is 189051237
Failed:
Essentials: Failed to retrieve userId from the assigned usernameParameters
player: Player
debugging: bool
References
Last updated