Hello,
I need help about dataStore and especially about GetOrderedDataStore().
I have a dataSaved as a table (In the 1st script named “dataToSave”) and i need to order just 1 of the 3 value in my table how can i do that (The value that i need to oreder is the dataToSave[1] (for after make a global leaderboard?
Here is the script that is used to manage dataStore
-- << Services >> --
local DataStoreService = game:GetService("DataStoreService")
-- << Variables >> --
local dataStore = DataStoreService:GetDataStore("MyNewData")
-- << Functions >> --
local function saveData(player)
local dataToSave = {
player.DataRepertory.BetterTime.Value;
player.DataRepertory.LastTime.Value;
player.DataRepertory.WorseTime.Value
}
local success, err = pcall(function()
dataStore:SetAsync(player.UserId, dataToSave)
end)
if success then
print("Data has been saved !")
else
print("Data hasn't been saved !")
warn(err)
end
end
here is a part of the second script about orderedData
-- << Services >> --
local DataStoreService = game:GetService("DataStoreService")
-- << Variables >> --
local scoreForLeaderboard = DataStoreService:GetOrderedDataStore("MyNewData")
-- << Functions >> --
local success, errorMessage = pcall(function()
local Data = scoreForLeaderboard:GetSortedAsync(true, 10)
local topTEN = Data:GetCurrentPage()
)
Thanks, if u need any things in more tell me