This algorithm refers to two frames: Players and ReferenceFrame. After cards are saved to storage, this script refers to an invisible frame to swap players in order of rating (highest to lowest). This script is only working for most of the cards. If I saved 24 cards, an average of 15 cards will be stored and sorted while the other 9 are deleted.
for i = 1, 12, 1 do for k = 1, 12, 1 do local a = tonumber(script.Parent.Parent.ClubMenu.Players["Card"..k].PlayerRating.Text) print(a) local b = tonumber(script.Parent.Parent.ClubMenu.ReferenceFrame["Card"..i].PlayerRating.Text) print(b) if a > b then local isUsed = false for z = 1, #array, 1 do if array[z] == k then isUsed = true end end if isUsed == false then table.insert(array,#array,k) script.Parent.Parent.ClubMenu.ReferenceFrame["Card"..i].PlayerName.Text = script.Parent.Parent.ClubMenu.Players["Card"..k].PlayerName.Text end end end end wait() for j = 1, 120, 1 do script.Parent.Parent.ClubMenu.Players["Card"..j].PlayerName.Text = script.Parent.Parent.ClubMenu.ReferenceFrame["Card"..j].PlayerName.Text end wait(1) script.Parent.Parent.ClubMenu.Visible = true end)