That's what happens when you literally copy paste from Fleep's tutorials.
The variable he uses to get the amount of players only works on your own server as far as i know. Simply replace the max value in the entity loop with 32 or 64 or learn how to get max players on any server.