Acces Data when Player is not in game

Im making a Login Page where Player need to login.

I can access the Player Data with player. when the Player is inside the Game but when he is not inside the game i cant use player..

How can I change the name of the data?

Like when the Player creates a UserName the username will be like afiawf@gmail.com or GamerRoblox1232 and the Name will be the Data Name or i dont know

Are you using an email Login? So they have to enter their email to play?

Not exactly sure what you are doing here.

If you are trying to get the username of the player which you know the name of, you can always use the functions of Players such as GetNameFromUserIdAsync . See the documentation for other info.

They dont need they can


No i dont know the username, so if the Player creates a Account in my Game, logout from the Roblox Account where he created the Account, login in another Roblox Account, enter my Game and when he login with the created Account in my Game he has his Data there. But how can i access the Data then?

How are you storing the data in the first place?

If you are saving the data into DataStore then you would simply GetAsync the key for the name the person logged in with.

How could i change the Keys name

If, like @MiriVokrium said, you are using a DataStore just use make your key something along the lines of Player_USERIDHERE.

You should really be using the UserId of a player at some point in your key, this is data that does not change about a player. However, if you begin using data like the Name then that is a property that can change, meaning data could be lost unnecessarily.

However, I don’t see why you’d need to access the data about someone without knowing their username?

2 Likes

Because he can create the username he wants

You should be accessing data through information you can get from a Player DataModel, such as the UserId.

Their ‘custom username’ should be the data you are storing.

Can i also make it without userid?

No, using the player’s UserId should be the only way to store data related to the player

Asking for Email Adresses is against Roblox TOS. Your game + Account will get deleted if you do so.