The method I use to save data is that I make a folder in the player and put the values in that folder but it seems that it is not the best way and that it is better to use tables. But, I don't really have much knowledge about this. Can someone help me with this or provide links that can help me do what I want to do? Thanks in advance.

EDIT: This is what is inside my script and I don't know how to advance it any further. I am really stumped and I don't know what to do next, but for now, I want to just be able to load and save the data and possibly use pcalls?

-- Variables

local Players = game:GetService("Players") -- get service
local DataStoreService = game:GetService("DataStoreService") -- get service
local DataStoreKey = "qwerty" -- change this to reset data
local Data = DataStoreService:GetDataStore(DataStoreKey)


local StarterData = { -- value of the data when a player first joins the game
	["Novas"] = 100;
	["Level"] = 1
}

-- Code

Players.PlayerAdded:Connect(function(player) -- event when player joins
	local key = "User_"..player.UserId -- player key
end)

Players.PlayerAdded:Connect(function(player) -- event when player leaves
	local key = "User_"..player.UserId -- player key
end)

4 comments

1

Tabes are the best way to store data. I have not clue why Object Values were used to store data and it has become the norm.

0

Please update your question to include your code attempt then we can help.

0

Use "for i, v in pairs()" to add each value inside the folder to one table, then save that table. I typically use a folder to store a player's data while they're in game, then add the values of everything in that folder to a single table inside the data save script, then save that table. When the player joins, I create the folder and add the values into the folder from the saved table.

0

I edited my post to what I tried to do. Please help me do this as I am really stumped.