Download

Can I set a variable on the server through client input?

Hello,

I attached a few images from the player character’s blueprint.

What I want is for the player to hold down a button, to charge up the initial speed of the spawned projectile (by using a float that increases as the button is held down, i called it Shuriken Speed).
When the player releases the throw button, it executes a Spawn Actor node, with the Initial Speed input connected to the float that sets the throw power (ShurikenSpeed).

The server seems to be detecting input from the client, because the print string after setting ShurikenSpeed is called when playing as the client, but it only returns the string: Server: 0.0

So maybe the problem is that the Get Input Key Time Down is not being replicated to the server through the client? Because it is going through the Set Shuriken Speed node on the server-side, when holding down the button as the client, after all.

I can’t set or get the ShurikenSpeed variable from the client side, because the projectile should spawn server side, and the Spawn Actor node can only get the Initial Speed input from a variable that’s set by the server (if I understand correctly). That’s why I’m wondering if there’s a way to change a variable on the client and replicate it to the server. There’s probably a better way of going about it, but I can’t seem to find a solution that works.

Any help would be greatly appreciated, thank you.