Problems with SortOrder set to name not working in a UiGridlayout - Solution

So I have a UiGridlayout that orders the frames by their names but the problem is that for some reason a frame named ‘9’ is ordered below those with names with higher numerical value

image

So the name:2 is 9 not 2. I forgot to update the text when changing the name

I can’t update the ScrollingFrame every time a new unit is added, that’ll be way too much, is there a work around this bug?

Explain to me how your system works

I add a frame whenever a instance is added inside a folder, depending on the rarity of the unit I name the frame i.e. local

local RarityTable = {
["Secret"] = 7,
["Mythical"] = 8,
["Legendary"] = 9,
--Epic = 10
--Rare = 11
}

I start from 7 so I can put the equipped units at 1,2,3,4,5, and 6, slots:

local EquippedIndex = {
1,
2,
3,
4,
5,
6,
}

After a while I did finally think of a solution!

I was missing around with different numbers by naming frames different numbers from 1 to 10 and I found that it all worked until the number 10/a number higher than 10. When I got to 10 the frame would act as if it was 1, with 20 it would get like 2, with 30 it would act like 3, with 400 it would act like 4, etc. This would carry over with negatives where -10 is seen as 1(or -1, I’m not too sure), furthermore this includes any and all numbers higher than or equal to 10, or less than or equal to -10.

My solution for this was to not use any number that is greater than or equal to 10, or less than or equal to -10. And yes that does include decimals, meaning you are not limited to(as far as I can tell) a specific amount of numbers(e.g. 0.1, 0.2, 0.33, 0.0444444, 0.5555555, etc).

Edit:

I just looked this up again, another fix is using a property called LayoutOrder in your frame and setting the UiGridlayout’s SortOrder property to LayoutOrder. Basically I didn’t know this was a property :sob: . It works the same as naming it but it can handle numbers above and below 10/-10