Right now I'm trying to sort a list of players by their level that is in their player
SortByLevel = function() local tab = {} for k,v in ipairs (game.Players:GetChildren()) do repeat wait() until v:FindFirstChild("Level") table.insert(tab,{v.Level.Value,v.Name}) end table.sort(tab) for i = #game.Players:GetChildren(), 1, -1 do local n = tostring((#game.Players:GetChildren() - (i-1))) body:FindFirstChild(n).Text = n..". "..tab[n][2] end end
So I get the error saying that the line where it sets the text is indexing a nil value, how do I fix this? I'm sure this is some simple solution I just have never made a leaderboard before...