There is no global variable called "player" (think about it for a moment: which player?). Without knowing the context, I can't tell what the solution is, but most likely you either want to pass in the player as an argument to the function you're writing, or else you want to iterate over all players.