Is there a better way I could make my dictionary go in order without having to refer to another table?
player_commands = {
settings = {
button_size = UDim2.new(0, 95,0, 30);
max_col = 4;
dir = options.players_commands;
padding = 2;
order = {
'Kick';
'Kill';
'Explode';
'Burn';
'Load';
'Tp_to_me';
'Tp_to';
}
};
commands = {
Kick = function()
end;
Kill = function()
end;
Explode = function()
end;
Burn = function()
end;
Load = function()
end;
Tp_to_me = function()
end;
Tp_to = function()
end;
}
}
do
local col = 0
local row = 0
local count = 0
for a,b in pairs(player_commands.settings.order) do
local v = player_commands.commands[b]
-- Have to use this to go in order
local button = create("TextButton")
{
Text = b;
Name = b;
BackgroundTransparency = (count % 2 == 0 and .3 or .5);
BorderSizePixel = 0;
Size = player_commands.settings.button_size;
Font = "Legacy";
FontSize = "Size12";
TextColor3 = Color3.new(1,1,1);
Position = UDim2.new(
0,5 + ( (player_commands.settings.button_size.X.Offset * col ) + (col * player_commands.settings.padding)) ,
0,5 + ( (player_commands.settings.button_size.Y.Offset * row ) + (row * player_commands.settings.padding)));
Parent = player_commands.settings.dir
}
row = (col + 1 == player_commands.settings.max_col and row + 1 or row)
col = (col + 1 == player_commands.settings.max_col and 0 or col + 1)
count = count + 1
end
end

3 comments
The reason it's not going in a specific order is because the commands table does not have integer keys. You could modify the script so that each key/value pair is in its own table within the commands table. That way each command has an integer key, which allows it to go in the correct order.
I know, that's why ipairs is useless in this case. I was just wondering if there was something else I didn't know about.
Well, Lua stores non-integer keys in a hash table, so I doubt it's possible to preserve the order.