Issue with datastore playerID

Hello, I’m having an issue where I can’t search a specific user on data.
I wanted to search by username, not by ID.

“the data going be saved on PlayerID”

 `DataStore2:SetAsync(playerID, {
	username =  TextboxUsername,
            Admin= true,
            Mod = false,
          })`

SetAsync only sets the data and not retrieve it, not sure if that is the issue

You could use Players’ GetUserIdFromNameAsync method to get the UserId using a player’s username

bro like the username gonna be choosen by the player but i wanted search by the usename that the player choosen

If I understood correctly, you want the player to set a username, you save that username, and then you can search by that username?

If you want to save by UserId, this won’t be easy. You could try saving by the username, and using ListKeysAsync() to search that way - otherwise you’ll have to check each individual player’s data.

yea
nice idea thanks i think that going work