Hey Robert! There are a few things which aren’t right here replication-wise.
-This is all happening in a PlayerController. PlayerControllers only exist on the server and the client which owns them, which you’ve probably gathered.
-The InputAxis values are local only - they will be 0 when accessed from any machine that isn’t the one physically pressing the button. Even so, the event will (I believe) still get called on the server’s version of the PlayerController - just with a value of 0.
-Here, you’re attempting to set ForwardAxisAmount, a replicated variable, on the client. Replicated variables have to be set on the server - the nature of a replicated variable is that the server will constantly update all the clients with the server’s value.
So when you set ForwardAxisAmount on the client, it is immediately corrected back to 0 - the server’s value of MoveForward*WalkSpeed. If you want to set it on the server, you would make a Server RPC, like this:
Here, you’re passing the client’s value through to the server (it’s important that the Set node is getting its value off of the ServerSetForwardAxisAmount event, not the InputAxis MoveForward event - otherwise you’d just be telling the server to set ForwardAxisAmount to its own MoveForward value, which is 0).
However, even this won’t work, because this is happening on tick on both the client and the server - every tick on the client machine, the client tells the server to set ForwardAxisAmount to its MoveForward value. Meanwhile, on the server machine, the server is doing the same thing, constantly telling itself to set ForwardAxisAmount to its MoveForward value - which is 0, because no physical input is being received on this machine.
So, we’ll hide the whole thing behind an Owning Client RPC:
So this is saying, only run OCSetForwardAxisAmount on the owning client. On the client machine, we’ll hit that node, go “okay, I am the owning client, so this is fine” and move ahead to ask the server to set the variable to the value we want. If we hit OCSetForwardAxisAmount on the server, we’ll do nothing further on the server, except tell the client machine to run OCSetForwardAxisAmount.
I could be wrong about some things, although that has only happened once before. I’m not 100% sure that InputAxis nodes still exec even on non-owning clients. It would be good if they didn’t.
Further to this whole thing, though, you’re probably going about what you’re actually trying to do in a bad way - ideally, your AnimBlueprint should need little-to-no information about the actual input that’s happening, especially if that suddenly means you need to constantly send an input value over the network. Instead of having your blendspace key off of ForwardAxisAmount, it would be better to go off of the actor’s velocity - something that you can be sure you always have access to without network shenanigans. Even if you make this approach work, you’re unnecessarily trying to do a server RPC a bunch of times per second.
Also, the more your AnimBlueprint is kept church-and-state from your input and your replicated classes, the easier it will be to keep that animblueprint when you try to do other things with it - e.g. put that animblueprint on an NPC and have it work right without any changes.
Hope this halp