How to find any account from a script

Currently, I’m making a command called searchplayer (UserId). This is supposed to find that UserId of the player and then give information about them, however, instead of looping through all the players in-game, I want to loop through every single account on Roblox. Is there any simple way to do this?

I do not need help making the command nor finding information about the user, I just need help with searching through every account created.

There may not be all the information that you are looking for, but most API that take a userid are under the PlayersService.

There are over one billion accounts registered on Roblox. This is going to take a suuuuuuuuuuuper long time. There are also terminated accounts in between, so you may not be able to grab some information about those. Anyways what is your use-case for something this hefty?

I’m simply just making this command so I can view their Account Age, Group Rank in my group, Name, and UserId, without having them be in-game.

I am gonna go ahead and assume you have already created such function, but the question is why do you need to go through every single account when you can just search a specific user ID without going through the hassle the former will make you go through

1 Like

I find it more convenient, and a better way to find a player’s information instead of having to search their username on the site. There is a way to do it, considering in one game you can search any player’s criminal record by typing their username in.

1 Like

You should not be looping through all of the players on Roblox to find information about any one specific user, as that is an incredibly inefficient method to achieve what you want. In the specific use case you mentioned about searching up somebody’s criminal record(I’m going to assume you’re talking about in the game and not Roblox’s moderation history) what you want to do is access a table in the game where the values for each player are stored with a key pertaining to that specific player.

1 Like

There will not be a player object for users who are not in the server. You may have to set up an external server, and use HTTP service to have it relay information from the Roblox website. Either that or you may be able to cache user’s info using the datastore service when they are in the game, depending on your usecase.

2 Likes

@liuthemoo @VitalWinter @sjr04

Thank you for the help. I’ll take that into consideration. I thought it would be a simple function to do this, but I was wrong.

You can use Players:GetNameFromUserIdAsync to get the Username. For verifying if a Player is in a group or not use GroupService:GetGroupsAsync(UserId).