I don't have your old code to look at. In your current code, I do not see anyplace where you set a value for player. Since you were trying to use it with var or as #player, I assume it was a user variable. Also, $player is not an available system variable.
I don't have your old code to look at. In your current code, I do not see anyplace where you set a value for player. Since you were trying to use it with var or as #player, I assume it was a user variable. Also, $player is not an available system variable.