Sorts table elements in a given order, in-place , from table[1] to table[n] , where n is the length of the table.

So the table.sort functions only sorts from positive indices [1, n], which -1 and -2 aren’t in therefore it will not be sorted.

Rather than setting the indices of the table gamedata to integers outside of an ordinal range. Try putting the user id inside the table containing the index kills and insert that table to the table gamedata.