Saving tables to a datastore

I’m working on a part of this game where the player can make an account, the account has a password and username, when the player makes the account the info gets put into a table like this

When the player leaves the game it prints the table with the players name and a table connected to the players name containing the username and password

I wanted the table to save to a database so when the player joins back it will look through the table and find the players name and log them in.

I want to learn how to use databases and I want a solution to the problem I’m currently on. If there is a better way of saving the players info tell me or if not help me. Please :kissing_heart:

Hello, there’s a few issues here.
This code appears to save every player’s data, not just the person that left.
I would also not recommend asking users to enter a username/password because this could be considered a scam game.

The best way for you to learn how to use Roblox datastore is to read the documentation here: Data Stores | Roblox Creator Documentation
(Specifically the Setting Data and Reading Data sections)

I’m not telling them to login to an account I’m telling them to make an account.

Basically how it works is.

There is a folder in rep storage called playerList

every single time a player makes an account it makes a folder with the username, password and user Id associated with the account they made.

when a player makes an account the folder goes into Playerlist and when a player joins it gets the players Id and makes an attempt at matching it with one from the Playerlist

If it can’t match the user Id then it makes the create an account or sing into an existing account.

I’m struggling with saving the children from a player list folder. Is there anyway you could help with that?