How does DRP arrange jobs in the scoreboard?

Im developing a scoreboard for DarkRP and Im wondering how it arranges the jobs in the scoreboard?
Like for example, when you press tab with a full server, youl see in order by jobs. Youl get the citizens all in green all together and the CPs all in blue and again all in order.

How would I go about doing this? Is there a table convar I can get from DRP to fetch all the players current jobs and arrange them accordingly in the scoreboard?

Any ideas?
Thanks!

By default, it’s the order the teams are added I believe. There’s sort buttons at the top that changes the sorting.

How do I retrieve a table in order for me to display them though? Is there a convar in DRP I can fetch?
Thanks!

team.GetAllTeams() ?

Ah sorry, It sounded wrong. I ment get all current players along with ther jobs and arrange them accordingly on the scoreboard.

Thanks!

Just loop through the players (player.GetAll()) and insert the data, including what job they are in (team.GetName(ply:Team())), into a table for sorting using table sorting methods (eg. table.SortByMember).

Worked great Bo98! Il post the code I used for it.