I am trying to arrange players inside of a table where 'blue' team is listed first and 'red' team is listed last. However, my script[which should work] that inserts all players in blue team first and inserts red team players last inside of a table is not working correctly. Here it is:
RunService.RenderStepped:connect(function() Players = {} for _, v in next(game.Players:GetPlayers()) do if v.TeamColor == BrickColor.Blue() then table.insert(Players, v) end if v.TeamColor == BrickColor.Red() then table.insert(Players, v) end end end)
Whenever I call the table, sometimes a player in the red team is stuck in between all the players in the blue team list and it gets more confusing there.