Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What are ORDERED data stores?

I know Data Stores themselves, Can anyone explain how 'ordered' data stores work though? I'm not asking for a script, just an explanation.

1 answer

✓ Accepted answer

"OrderedDataStore is a type of DataStore where the value must be an integer (positive number). This is done in order to create a way to easily order key/value pairs, making it suitable for leaderboard related scripting where you are required to order large amounts of data efficiently. For example, you can write a script that shows the top 100 high scores in your game. "

OrderedDataStore work much like DataStore. The only different is that OrderDataStore return a table of, well a DataStore but in a order. For Example, 'highscores'

local OrderDataStore = Game:GetService('DataStoreService'):GetOrderedDataStore('HighScore')
local Pages = OrderDataStore:GetSortedAsync(false,  5) 		
local Data = Pages:GetCurrentPage()             
for Key, Value in pairs(Data) do 			             			
	print(Key .. ": " .. Value )	
end

That would print out the greatest amount of points to the lease.

OrderDataStore order the data by integers.

Accept and upvote :)

This discussion is preserved as it was. New answers, comments, and votes are closed.