Why does this function not work?


function matchbegin( ply )
	red = teams[1]
	blue = teams[0]

	if red.team.NumPlayers() >= 1 and blue.team.NumPlayers() >= 1 then
		print("Hello")
		ply:PrintMessage( HUD_PRINTTALK, "Game will be starting soon!" )
	end
end

Function will not work whatsoever, doesnt print anything at all or send the player a message, What did i do wrong? :frowning:

Thanks in advance!

Remove red and blue from the team.numplayers

Wont i need it as im checking how many players are in the Red team and Blue team?

there is nothing called red . team numplayers or blue . team.numplayers only team.numplayers

Alright so when i remove the red and blue, How am i supposed to check the players in the red team and the blue team?

well get the integer from the team setup. So if blue is 1 then you write
[lua]if team.numplayers(1) <= team.numplayers (2) then
print(“hello”)[/lua] you get what i mean right? Im sorry if im unclear but im on my phone and its quite hard/annoying to write clearly. And im quite tired

I know for a fact your blue team number was 0 and red was 1 so it would be
[lua]function matchbegin( ply )
red = teams[1]
blue = teams[0]

if team.NumPlayers(1) &gt;= 1 and team.NumPlayers(0) &gt;= 1 then
	print("Hello")
	ply:PrintMessage( HUD_PRINTTALK, "Game will be starting soon!" )
end

end[/lua]
[editline]Somedayfhdhjfhd[/editline]
Shit ninja’d but will keep this here as it has the whole code he would need plus you misunderstood the function he had in the first place

Thank you :slight_smile:

[editline]26th June 2014[/editline]

Thanks for the explanation :slight_smile: