I think the issue is that the green and orange players are AI-controlled. And, I assume, in my case, everything works correctly, and the MessageBoxForPlayers message for AI players is simply redirected to the human players. But in your case... we'll find out. Leave the print statement, but in the number variable, revert to your old formula for calculating the player number.
I reverted everything to how it was, tried it out, and it seems like it worked the same way with my script as well.