My plugin provides drag-and-drop functionality, so clear and sequential numbering (e.g., 1, 2, 3…) is essential.
The current behavior leads to confusing orderings such as:
1, 10, 11, 12… then 2, 20 and so on, which is not script-friendly.
4. Impact on developers
Here’s why this limitation is problematic:
Developers may not realize this hidden issue with UIListLayouts when they program elements in their game. They may create systems the fail after game release and must be entirely rescripted.
This represents a significant failure of Roblox’s UIListLayout.
It appears to be an issue that can negatively affect many games on Roblox and has platform wide implications.
Hey guys if I cant find a solution I’m going to create a bug report because while this functionality may have been intention Its extremely poor and should not exist.
The way the name sort works is it goes through each character in the names. It compares all of the first characters, determining which character is considered ‘lower’ (likely from an ASCII table), then all of the second characters and so on, until each object is corrected sorted.
Because of this, it will have all the names with a 1 as the first character together, then all the ones with 2 and so on.
This behaviour is correct, and is mainly meant for when you have purely alphabetic characters (i.e. not numbers) in the name.
If you don’t want this behaviour, then you shouldn’t use the name sort function. You need to use layout order. Layout order IS controllable, by adjusting the LayoutOrder property in the objects.
Thanks for the help. What do you mean Layout order is controllable. Its widely known that Layout order is Not controllable. Can you clarify exactly what you mean by this, and how its controlled?
this behavior should be expected when using ‘Name’ sort
‘IndexA’ comes before ‘IndexB’
‘IndexAZ’ comes before ‘IndexB’
‘Index1’ comes before ‘Index2’
‘Index10’ comes before ‘Index2’
it sorts by the name, not the number in the name
a solution to getting a proper sort would be getting the numbers from the name and sorting them with table.sort() (using LayoutOrder)
local Elements = {"Index4", "Index1", "Index3", "Index2", "Index10"}
local SortedElements = {}
for _, Element in Elements do
local number = tonumber(Element:match("%d+"))
if not number then continue end
SortedElements[#SortedElements + 1] = {["Name"] = Element, ["Index"] = number}
end
table.sort(SortedElements, function(a, b)
return a.Index < b.Index
end)
for LayoutOrder, Item in SortedElements do
print("Element:", Item.Name, "LayoutOrder:", LayoutOrder)
end
--[[ Output:
Element: Index1 LayoutOrder: 1
Element: Index2 LayoutOrder: 2
Element: Index3 LayoutOrder: 3
Element: Index4 LayoutOrder: 4
Element: Index10 LayoutOrder: 5
]]
they aren’t impossible to use; they just lack sorting options
No one ever has declared that Layout order is not controllable. Only you.
In all UI objects, there is a property called Layout Order. The higher the value, the higher up in the ‘sort’ the object appears.
Thank you for providing the solution. Your assistance will undoubtedly save future generations from the time-consuming task of scripting around the limitations of alphabetical sorting systems when managing numeric data.
Attention, Future Developers:
DO NOT FALL VICTIM TO THE PITFALLS OF UIListLayouts!
How to Protect Yourselves:
Set the SortOrder property to LayoutOrder
While it’s a common misconception that LayoutOrder is uncontrollable, new information suggests otherwise…
Assign a value to the LayoutOrder property
This revolutionary feature allows you to control the exact position of each element. By specifying the position numerically, you can handle even more than 9 objects without running into sorting issues.
Act now, and rescue your project from the chaos of alphabetical sorting.
That’s on me, mb, I meant due to how you currently have it setup,
Instead of using “Name” for the UIListLayout SortOrder, use the LayoutOrder SortOrder value, and the layout order property found in every object and can be edited via script, plugin, or manually.
This way not only can you keep your current name scheme of naming the frames.
F1
F2
F3
But, actually organize them as such when you pass 10 UI instances, so it’s readable and organized
Mb on the miscommunication!
(also # is a representation of any type of number, if used in such context)
Thanks you for the assistance. In order to create greater clarity regarding this new information, I have marked my post as the solution for the many developers who require detailed information regarding the trick of UIListLayouts.