Hello,
In my group’s new game, at the end of every round, a sort function is called to see who had the most kills, the most captures, etc. that round, and display it.
However, an extremely rare glitch I’ve seen pop up, is the following:
with this line of code:
local function sortedHighest(stat)
--- Stat is the name of the stat we are looking to sort.
local player_list = Players:GetPlayers()
table.sort(player_list, function(p1, p2)
return p1:GetAttribute(stat) or 0 > p2:GetAttribute(stat) or 0 -- or whatever you want to sort
end)
return player_list
end
This is something that is definitely not ran into very often. The ONLY time I’ve noticed this has happened, is when a player leaves at the exact moment that this code is being ran at.
Does anyone know what the issue is here, and how to fix it?