I have a folder in a player's leaderstats thats holds all of the players data. I want to save all the values inside that folder. How can i do that?
COMMUNITY QUESTION
How can I use DataStore to save values inside a folder?
1 answer
You would setup a normal data store and then check the folder and add the values to a table like this when a player leaves
local UniqueKey = "Special-"..Player.UserId -- the key to the data store to get a certain players data
local DataFolder = Player.leaderstats
local Datatable = { -- Add values to this as needed
DataFolder.Level.Value,
DataFolder.Kills.Value,
}
Datastore:SetAsync(UniqueKey,Datatable) -- Saves All The Data
This discussion is preserved as it was. New answers, comments, and votes are closed.
