Communication of variables between classes?

Try with “Get player pawn” and the cast on your character. Like this:

I copied your script and tested it and it works fine.