I'm working on a game, and these ordered data stores are something new to me. I have all my data auto saving to the standart data store. But i want to create global leaderboards. The question is: can i save my data table to an ordered data store? Or do i have to save each value for global leaderboard to a new data store?
✓ ANSWER ACCEPTED
Ordered Data Stores: Can i save a table?
1 answer
✓ Accepted answer
Hello, luachef!
No, you can't save tables on OrderedDataStores, but you can on normal datastores
Saving normal Values:
game:GetService("DataStoreService"):GetDataStore("DataName"):SetAsync("Stats", 255) --This will save 255
This will also work: (Table)
game:GetService("DataStoreService"):GetDataStore("DataName"):SetAsync("Stats", {7, "This", "Is", "A", "Table"}) -- This will save a table with 7, "This", "Is", "A", "Table"
And this will also work: (Dictionary)
local SaveMe = {
["Level"] = 5,
["Name"] = "Leamir",
["Position"] = Vector3.New(0,0,0),
["Table"] = {"This", "Is", "A", "Table", "On", "A", "Dictionary"}
}
game:GetService("DataStoreService"):GetDataStore("DataName"):SetAsync("Stats", SaveMe) -- This will save the Dictionary SaveMe
Saving tables or dictionarys change the way you do to get the data, you'll need to treat the data like a table/Dictionary
To make a global leaderstat, you should save the Local Leaderstats on a table and then you should test it for all servers, to se where it should be added on the leaderboard
Good Luck with your games
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Ordered data stores can only store integers. What I'd do is create an ordered data store for each stat, so no to your first question, yes to the second.