Replicating UI

Hi guys,

I have two problems if u know even one of their solution pls tell. So first. I have a widget in my chest BP and I only set it to visible when the player gets near it. But if any player get’s near it it becomes visible for all players. This is something I don’t want. And second the same widget starts filling up as the player continuous to press the interact key. But since I want the chest opening to be replicated I used an authority switch to have server always call the function at the end. Because of this the filling up is not shown for the client who is pressing the interact key. Only the server.

Thx in advance guys :slight_smile:

  1. Assuming you are using an Overlap event to show the widget, you need to check if the overlapped character is the local player’s character. Overlap events trigger for all characters in the world, not just yours. So when another player approaches chest, it triggers overlap on their machine, on server, and on your machine. You can use builtin character function IsLocallyControlled to check this.

  2. Only the local player knows about his own input, so first you need to replicate the input (or the fact that player wants to open chest) to the server. Then you need to replicate that from server to all players. For example you can add a boolean variable bIsOpen, and make it replicated with RepNotify. Then in the notify function OnRep_bIsOpen, open or close the chest according to variable value.

Documentation has a good example about chest opening (4 parts) although it doesn’t cover replicating the input, it should help you get the rest right.

Srry. I didn’t check yesterday. The first one can only be called one a character so how exactly should i use it?

And could u pls send an example for how to use the second one? In my project I have a widget that has an event tick which checks if the player has started pressing the key which is send from the player to the chest through a blueprint interface. And from there to the widget through the widget that is displayed. And once the progress bar is full it sends an event dispatcher that the chest uses to open itself.

I am a beginner and I am srry for my lack of information.

It worked. Ur solution was amazing. Thx
But the thing is my player can see another player’s progress. I want the player to only see his own progress.