In pairs in wrong order... What am I doing wrong?

Out of all the years that I’ve scripted I have never encountered this issue. Maybe it’s just because I’m dumb but when I index my table in I pairs, it goes in the wrong order?

	local TeamNumbers = {
		["BlueTeam"] = 0,
		["RedTeam"] = 0,
		["GreenTeam"] = 0,
		["YellowTeam"] = 0,
	}
	
	for Team,v in pairs(TeamNumbers) do
		print(Team)
	end

Output:

RedTeam
BlueTeam
GreenTeam
YellowTeam

Maybe it’s just because my brain is dying right now, but I seriously have never seen something like this happen. Does anyone know what is going on here?

Maybe try doing ipairs instead of pairs?

Nevermind, just checked and doesn’t even print it out.

1 Like

in pairs goes randomly,

try using table.sort, it could work out.