Issue with tables

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

image

I just realized, it’s not about the number being under 10, its about the first number it doesn’t account for the 0s at the end of a number
image

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)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.