Set a variable online error

Hi all… I ve created this way to decrease a variable but i don’t know why it works only in the server… why?

I think your image is broken.

Just a guess, are you trying to change a variable on the server from the client?

Yes, i m. I m calling that fuction from the client to the server. In this way you say to the server to change that variable

I still can’t see the image. Can you try something like instead please?

Try using Print String to check if the function is actually being called.

Also, try using Print String to get the value of “New Param” and see if it’s your expected result.

Done all and the print works but the variable it’s every time the same(Apart if you are the server). On the client the server say that the variable is changed, but nothing happens to my character. If istead i m the server my pg dies like he should

Are you saying that the variable for the client doesn’t update? If so, you’ll need to set the variable on the client as well I think. Or do you mean that “New Param” is always the same value?

The new param is a character BP(I have to get his variable and change it) and it’s always the same. The event are this: Something fall: i have to understand what, so i take what fall and cast to all my BP actor for to understand what actor is. Next i have to change their variable to 0. So i used this event

Okay, so are you doing some kind of lives system? So, for example, the player falls, and their lives get decreased by 1.

What are you expecting to happen? Should the player die? Have you told the client how the player should die?

When the player falls i set his hp to 0. His BP character have a branch with an event tick that if the HP are = to 0, he dies. This work only on server, not on client

You could try setting the variable to replicated if you haven’t done that already. That’s supposed to share the variable value from the server to the client.

I already setted the vaeriable as replicated

By the way, you said earlier that you were sending the variable from the client to the server. There is a different way to send from client to server, you’ll have to look online. Be careful what you take from the client because it is possible for them to send any value that they want.

I think you’re looking for replicated functions.

If i say to the client to send me a variable, he will send me that variable, so how he can cheat?

If you send a variable from client to server, there is a risk involved.

You can read more here:

I read but i don’t understand. How you hack an integer? I mean, if i program that if the client hit the server, it deals 25 damage, how he can hack? Btw i m still searching a way for set that variable

It’s possible for the client to modify the value that is sent to the server.

Regarding your issue, networking is well documented here:

Please, can someone help me?

Please, can someone helps me?