Picture: https://gyazo.com/526d5d557be31d1c0993d082f5315e5a Basically data is put into the table "playervals" and sorted by "RAP" which is a currency in my game.
Since the UIGridLayout sorts by name - in the for i,v loop it sets the name of the frame to a letter of alphabet (being first = a, being second = b etcetc) but whats strange is that if you had 715k and someone had 700b the person with 715k would be over them, someone please help
local playervals = {}
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Values") and v.Values:FindFirstChild("Currencies") and
v.Values.Currencies:FindFirstChild("Bux") and
v.Values.Currencies:FindFirstChild("RAP") then
table.insert(playervals, {Name = v.Name, UserId = v.UserId, DisplayName = v.DisplayName, RAP = v.Values.Currencies.RAP.Value})
end
end
table.sort(playervals,
function(a,b)
return a.RAP>b.RAP
end
)
for i, v in pairs(playervals) do
if v then
local player = nil;
if findplrlist(v.Name) then
player = findplrlist(v.Name)
else
player = templates.Player:Clone()
end
if v.VIP then
player.Info.Username.TextColor3 = Color3.fromRGB(255, 207, 85)
else
player.Info.Username.TextColor3 = Color3.fromRGB(255, 255, 255)
end
if v.Name == game.Players.LocalPlayer.Name then
player.SendButton.Visible = false
end
player.Name = abcs[i]
player.Parent = UI.Playerlist.List
player.Info.Username.Text = v.DisplayName
player.Username.Value = v.Name
player.Info.Level.Text = v.Level
if lb == "RAP" then
player.Info.Value.Text = ab.abbreviate(v.RAP)
else
player.Info.Value.Text = "????" .. ab.abbreviate(v.Bux)
end
end
end
