What’s the best way to make a database login system? Should I make a dictionary for every login? Should I just put it all into one dictionary? There are a few ways to go about it but I don’t use tables/dictionaries that often and I’m not sure what would be the fastest and most efficient for adding new logins.
The best way to do that is to
1- Check if the player that joined already has a password else you make that player create one
2- Later the player sets its password, create a table for example:
local username = player.UserId
local playerTable = {}
playerTable.username = password
data:SetAsync(Player.UserId, playerTable)
3- Save that data and then when a player joins again and that player has a password you can do something like
local playerTable = data:GetAsync(Player.UserId)
local password = playerTable[Player.UserId]
if password and text == password then (let the player join) end
(Edit: I switched the key for the table to be the userID since username could fail.)
You can use a third party system called firebase if you want to edit any passwords or users. Suggested to use the module created by MXKhronos Firebase Module. It’s a pretty easy setup and you will find your way with it.
Or you can use the roblox database like AstralBlu_e said.