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

Do datastores save and load in order?

The title says it all, if I save a table, do all the items within the table load in the correct order? If I can't do that, what can I do that will help me load in correct order?

--No script provided-- example,

local tbl = {1,2,4}

when saved the tbl, will it load in exact same order, 1,2,4 or will it just take like... 2,4,1

2 comments

1

I've worked with data stores in the past, saving tables specifically, and it does save in order

0

Thanks Incapaz

1 answer

✓ Accepted answer

There are two types of tables; arrays and dictionaries. Arrays are the "normal" tables, where the keys are automatically assigned to integers (e.g. 1, 2, 3, 4), and because of this they always keep their order. So, your example table (which is an array) will keep the order when being loaded or saved through datastore.

However, if your keys are not integers, like in dictionaries, there will be no order in the table. This is fine though since dictionaries allow you to better categorise your tables. My answer here outlines how you could use dictionaries with datastores for a save system.

1 comment

0

Thx dude

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