TryGetPawnOwner not working in AnimInstance

Yo! I started to use a seperate Actor class with a skeletal mesh component to represent my weapons instead of using a skeletal mesh component on my character, this has broken my AnimInstance class. I use TryGetPawnOwner in anim instance to fetch the PlayerCharacter class (the one my player controls) and use variables from that in an Animation Blueprint, but it no longer works.

This is how I am attaching my Actor to my Character in APlayerCharacter::BeginPlay

This is how I’m attempting to fetch APlayerCharacter inside of my anim instance
2

What am I doing wrong?

TryGetPawnOwner returns a Pawn* which you cannot cast to a APlayerController. You’ll want to use TryGetPawnOwner()->GetLocalViewingPlayerController() to get the APlayerController*.