I have a function to change some variables but I am unsure what is the proper method for replicating the Setting of this variable. Any help with this is greatly appreciated 's what I have and which is not working.
A ‘NetMulticast’ function runs on the server (if called on the server), and then out to all clients. Role will only equal ROLE_Authority on the server (for the most part).
Because of this, almost all of the calls to this function will result in your condition being false.
So what would be the proper replication to use? I prototyped this in a blueprint and am now moving it over to code. The blueprint works fine and where I had a Switch On Authority when I looked up what it was doing it went back to a bool in the Actorclass called HasAuthority which just returned Role == ROLE_Authority. So I tried to stay accurate to what worked. And I used multicast in the custom event which went thru the switch to the rest of the function.
Also what is strange is I can get the variable to increase and interact and increase again but if I try to decrease the value it works fine but on the next increase the decrease appears to have never happened. If it will help I will post a screenshot of the blueprint and try to put up a video.
If you are trying to change the value on the client, then you need to add a function to do that. Usually, it’ll be named ServerSetIntValue() and decorated with UFUNCTION(Reliable, Server). When the client calls that function, the value is sent to the server and executed there. Once modified by the server, the property replication will flow back to the client.