I’m trying to make a networked container witch only 1 player can interact with at a time.
For testing purpose, i added a replicated variable (IsOpen) to the container actor (placed in the level).
On the player controller i have an action event that does a line trace and if it hits a container it calls an OnUsed function(from the container) that changed the IsOpen value.
The thing is, when it’s called from the server everything works fine but when called from the client it doesn’t change.
I’ll appreciate if someone can help me figure out what i’m doing wrong here.
anyone has an idea about this?
Replicating a variable doesn’t do anything unless it is set on the server. So in your case if the server is updating the variable the changes are reflected to all the clients and it’s working as expected. But when your client is updating the variable, it is not set on the server so you need to create a custom event and run on the server and update the variable in the custom event this runs the code on the server. This way the changes are reflected to all the clients and server.
Hey make sure that the BP_Container class is replicated and use is locally controlled node and if it is true then run the custom event function make sure that it is run on the server. Show the screenshots or the output log with print statements so it will help to debug the issue