Table is sorting randomly

I’m trying to create a cutscene system, and I’m using a module script for the main tables. (messages, camera parts, etc.)

Whenever I use a for loop, it returns the tables in random order.
I used a print() function to debug.

What the order is supposed to be:
Screen Shot 2022-03-12 at 10.54.45 PM

What it’s giving me:
Screen Shot 2022-03-12 at 10.56.16 PM

I have looked for solutions on the forums, and the developer hub, but nothing was working. I even tried the table.sort() function and that didn’t work.

The for loop, and the debugging are in a local script, and the tables are in a module script.

Dictionaries’ key-value orders are not guaranteed, so sorting algorithms won’t do anything for it.

Resort to a recent thread about this here:

1 Like