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

[SOLVED] How can I arrange Frames in descending order by their name?

Asked by 3 years ago
Edited 3 years ago

I need Frames to be arranged in descending order by their name. I have inserted an UIListLayout in the parent frame and set the following properties:

UIListLayout.FillDirection = Vertical
UIListLayout.SortOrder = Name --The Frames will be sorted by their names
UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
UIListLayout.VerticalAlignment = Enum.VerticalAlignment.Top

These frames will be added, edited or removed by a script. Their names will be changed to a value named score so they can be sorted with the UIListLayout order. The frame with the highest number score should be on top. But instead, the frame with the lowest score stays on top and the highest score gets to the bottom. So how can I make that the frames be sorted in high-to-low order instead of low-to-high order?

Note: There is no problem with renaming the frames if necessary

1
If there's no problem renaming then you could just rethink how you've named them, invert it, the currently highest number should be the lowest Spjureeedd 385 — 3y
0
Is this a leaderboard? If so, does this leaderboard save for all server's? RockyRosso 12 — 3y
0
I'm not finding any way to invert the sorting order sorry, I think you'll have to rename them Spjureeedd 385 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

As mentioned by Spjureeedd, I think there is no better way than renaming all in alphabetical order like:

function numtostring(num) local str = nil
if num == 33 then str = "aa" elseif num==32 then str="aaa" elseif num==31 then str="aaaa"
elseif num==30 then str="aaaaa"elseif num==29 then str="aaaaaa" elseif num==28 then str="aaaaaaa"
elseif num==27 then str="aaaaaaaa" elseif num==26 then str="aaaaaaaaa" elseif num==25 then str="b"
elseif num==24 then str="c" elseif num==23 then str="d" elseif num==22 then str="d"
elseif num==21 then str="e" elseif num==20 then str="f" elseif num==19 then str="g"
elseif num==18 then str="h" elseif num==17 then str="i" elseif num==16 then str="j"
elseif num==15 then str="k" elseif num==14 then str="l" elseif num==13 then str="m"
elseif num==12 then str="n" elseif num==11 then str="o" elseif num==10 then str="p"
elseif num==9 then str="q" elseif num==8 then str="r" elseif num==7 then str="s"
elseif num==6 then str="t" elseif num==5 then str="u" elseif num==4 then str="v"
elseif num==3 then str="w" elseif num==2 then str="x" elseif num==1 then str="y"
elseif num==0 then str="z" end end

It works like this because the maximum score any frame can have is 33

Thank you for your help

Ad

Answer this question