Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I am having problems sorting with numbers?

So i made this basic script for a GUI that makes a copy of an imagebutton and then makes 100 of them.

Script:

MaxItems = script.Parent.MaxItems
ItemsAtm = script.Parent.ItemsAtm

TextBox = script.Parent.Scroller['1']

for ItemsAtm = 2,MaxItems.Value do
	TextBoxClone = TextBox:Clone()
	TextBoxClone.Parent = script.Parent.Scroller
	TextBoxClone.Name = ItemsAtm
	
	print(ItemsAtm)
end

the script works but whenever i do use it it sorts the numbers like: 1, 10, 100, 11, 12 ,... Image: https://imgur.com/a/JOlXh9U

is there a way that it could sort it properly from 1 to 100

if this is not clear please comment i find this hard to describe

1 comment

0

this is how the GUI looks btw : https://imgur.com/a/SplfUbv (note : it is using a uigridlayout)

1 answer

✓ Accepted answer

Hello, your answer is pretty simple. ImageButton has a nice property called LayoutOrder. Just change this property based on the number you are at in your loop.

This discussion is preserved as it was. New answers, comments, and votes are closed.