Dictionary gets sorted without using table.sort()

Hello, I want to achieve a table that is not sorted, since it’s automatically sorted it for me when I don’t want it to.

The issue is, I am writing a module script to set permissions and returning a dictionary, example below.

There is probably no solutions to this I guess but I still want to ask if anyone else is having this problem.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local permissions = {
BirthdayPerson = "UserId",
Administrators = {"UserId","UserId","etc"},
Moderators = {"UserId","UserId","UserId","etc"},
VIP = {"UserId","UserId","UserId","UserId","etc"}
}

You can use

local table = {[1] = nil, [2] = nil, etc}

Basically, you put numbers defining the index of the table for each item.

it turns out that it doesn’t sort it, it just randomises it?? I printed the order and it’s:

[Administrators]
[VIP]
[BirthdayPerson]
[Moderators]

It’s just a coincidence that you got the sorted dictionary value.
Did you use pairs (or next) to get the keys of the dictionary, this is why the keys are in the randomised order?

local perms = require(game.ServerScriptService.Permissions)
for name, a in pairs(perms) do

i guess i used pairs