How to get player from username?

I need a code that can get player from ONLY username that is offline

I think this is what you are looking for: Docs
Ex: (from docs)

local Players = game:GetService("Players")

-- Example Data:
-- UserId: 118271    Name: "RobloxRulez"
-- UserId: 131963979 Name: "docsRule"

local userIdOne = Players:GetUserIdFromNameAsync("RobloxRulez")
local userIdTwo = Players:GetUserIdFromNameAsync("docsRule")
print(userIdOne, userIdTwo)
-- prints: "118271 131963979"

What information are you looking to get? If you’re trying to get a Player Instance, that wouldn’t work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.