You've seen it everywhere, from the default leaderboards or even your own leaderboards. But I can't fit my mind around how to do it! I tried to use a table and put it in a for loop and go on from there, but my idea didn't work. Can someone help me improve upon my current script?
local plr = game.Players.LocalPlayer
local PlayerLabel = script.Parent.Parent.PlayerLabel -- this is the label used for all players
local Frame = script.Parent
local plrs = game.Players:GetPlayers()
local current = 0
for _,v in pairs(plrs) do
local pl = PlayerLabel:Clone()
pl.Parent = Frame
pl.Name = v.Name
--[[ so in this loop it creates a gui for every single player in the server. now positioning
each gui is where it gets tricky (and also where i am stuck) (and also ordering from least KOs to most) --]]
prioritytable = {}
for _, player in pairs(plrs) do
for _, compare in pairs(plrs) do
if player.KOs.Value > compare.KOs.Value then
table.insert(prioritytable,[current + 1]player)
end
end
end
end

1 comment
Thank you, this is the answer I've been looking for. (I am not familiar at all with table.sort!)