Get a player object even if they are not in the game?

How can I get a player (an object that has properties) from a player name?
I know that I can use players:GetPlayerFromUserId(), but I was wondering if there is a similar method for a player name.

For example, getPlayer(“Winky_y”) would return with a player object with all my properties.

All help is greatly appreciated.


No there is no way to achieve this. it is impossible to get the player object from a name/user id if they are not in the server. Could you explain what you are trying to do? If you want the player’s character model you can use:

1 Like

GetPlayerFromCharacter, GetPlayerFromUserId, and all the other GetPlayers functions, only search for players that are currently in the Server. You can not get access to the player object, unless it is inside the Players service.

However, you can get certain properties of a Player and it’s character through other means. What are you trying to do exactly?

I am trying to make an unban function for an admin script.

What the script does it loads the player, changes the datastore for that player to an unbanned state, then saves the player’s new data.

When a player joins the game the script checks if they are banned through the datastore, and, if they are, kicks them with arguments provided.


Why would you need the player object? You would just need the user id? Using player names for banning is ineffective since they can change their names.

Because it is an admin script, ideally a user would be able to use the command “unban Winky_y” and have it work.

It is true, you only need the UserId. Just trying to up the user experience.

EDIT: Just stumbled across this (just before @cjjdawg posted… lol.) :

Thanks guys!

You can use this method from the Players Service:, to find the UserId from the name, then add the UserId to the banned database.


Not sure why I thought that I needed the player object. Thanks for the help.