My table shows the numbers in the correct order, unless it’s any number under 10 then it automatically sends it to the front, why could this be?
Code:
local petsTable = {}
for x, pet in pairs(eggPets:GetChildren()) do
table.insert(petsTable, pet.Rarity.Value)
end
table.sort(petsTable)
for i = 1, math.floor(#petsTable/2) do
local j = #petsTable - i + 1
petsTable[i], petsTable[j] = petsTable[j], petsTable[i]
end
for x, c in pairs(petsTable) do
print(c)
end
Are you using a UIListLayout / UIGridLayout? If so, why not use LayoutOrder and set the layout order to be something like 10000 - RARITY * 100 (everything is * 100 to allow for 2 decimal places of rarity)