✓ Accepted answer
1st No you do not use the players UserId for the scope that would be like making a new file per player. The point of a database is to keep data in its tables not making one table per player.
2nd Thats not how you would make a ibrary to store the player's data. You would just use a module to setup the players data then use functions to set / get data.
Lastly you will need to look into how to save player data.
saving player data
Example of the basic idea of player stats object:-
local function newPlayer(plrUerId)
local f = {}
function f.Save()
end
function f.Get()
end
return f
end
local plrData = {}
game.Players.PlayerAdded:Connect(function(plr)
plrData[plr] = newPlayer(plr.UserId)
end)
game.Players.PlayerRemoving:Connect(function(plr)
if plrData[plr] then
plrData[plr].Save()
plrData[plr] = nil
end
end)
I hope this help.
2 comments
There you go. An upvote. lol
Thank you.