Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

I am having problems sorting with numbers?

Asked by 6 years ago

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

0
this is how the GUI looks btw : https://imgur.com/a/SplfUbv (note : it is using a uigridlayout) TigerClaws454 48 — 6y

1 answer

Log in to vote
1
Answered by
oftenz 367 Moderation Voter
6 years ago

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.

Ad

Answer this question