How to open chest replicated

I want to open a chest by the server and the client. I could open the chest but when I tried to replicate it only the server could open it and even that is not replicated onto the client. Here is where I am now. (this is the chest Blueprint)

P.S, if there is a more efficient way than using the event tick pls tell me so :slight_smile: .

Hi,

(1) Open_Replicate is a “RunOnServer” event, only the server can execute this and only the client that owns this actor can tell the server to execute this. If any other client tries to do so, then it will be dropped (nothing will happen). Theoratically you can change the owner of the actor during runtime, but imho in this case here that would be bad style.

(2) From your image, the only thing you’re replicating, is the “IsOpen” bool, which you set to true. The “PlayAnimation” node will only play on the server, not on the clients.

P.S, if there is a more efficient way
than using the event tick pls tell me
so :slight_smile:

Do it event driven, there is no need for tick here.

If you’re planning on having multiple different interactable objects, then you should overhaul your whole logic, cause the logic above won’t scale. I think I would go with one base class for all interactable objects and put one event in there (Interact) that all child classes would implement (for example a chest would open/close, an item would be collected, a door would open/close…). Then inside your player pawn / player controller on a player input event, you directly use a “RunOnServer” event to send it to the server (you don’t use any “RunOnServer” events inside the interactable object), then on the server you call the Interact event of the interactable object. So you would handle which interactable object is currently in focus of the player inside the player controller / controlled pawn.

Thanks. Yah I changed the whole approach. Followed this tutorial Unreal Engine - Searchable Chest Tutorial (2/3) - YouTube. And I was gonna have more intractable things.But now the same problem is it doesn;t replicate. Idk what to do

Can you show an image of how you’ve done it? (I just skipped through the video but didn’t saw any sign of multiplayer).

Also are you sure that neither point (1) nor point (2) of my answer are the cause of your new problem?