Getting player controller in multiplayer

I need to cast to TopDownController to get Sword Slash variable. It works at server side. But its not working at clients. How can i solve it. What can i use instead of get player controller or is there any way for casting or any other way to make this work in multiplayer. Can someone help me please ?

Thank you very much. :slight_smile:

PlayerController is not replicated to other clients other then local machine (if im not mistaken) for security reasons as users can do anything with there PC memory. use PlayerState which is replicated extension of PlayerController and should contain all public information (not tied to pawn itself) on player that all other clients can access. Same goes with GameMode, there GameState for exact same reason

Thank you very much for your reply. So get player controller is not replicated what do i have to put there to access that sword slash variable.
I am begginer in unreal engine so i couldn’t make that player state things and can you give me some examples maybe blueprint examples for me to do that. :slight_smile:

Put sword slash on the pawn instead, i think.

The PlayerController should only handle communication between a specific client and the server like Shadowriver mentions. You may want to move that variable to the Pawn/Character or PlayerState (if it is not related to the owner of the animation). Animation Blueprints have a helper function called “TryGetPawnOwner” that you can use if you are working with animations on a Pawn object. If not you can use GetOwningActor/Component.

I don’t know why no one else has mentioned this, but there is an alternative to player controller for multiplayer. It’s a node called Get Controller. You cast to your PC from there and then you’re not locked to a specific player index. You would run your custom event on “Owning Client” and it will grab the local Player Controller.
Some situations require you to use the Player Controller for multiplayer like “View Target with blend” for example.