Displaying widget only for player that interacts with an actor

Hello!
I have a Multiplayer setup, with two players and their characters, and an actor(a cube, for example) that contains a widget, and displays it when the player character approaches this cube.

The problem is, the widget is shown for both players, even for that one who is not interacting with a cube.

How can i fix this issue?

My best guess is, i need somehow differentiate the characters, and show widget only for those who is “main” character in the client exemplar.

Hi Lemon172

If the logic is in the pawn / character, instances of these objects will exist on all clients. Any logic that is fired will be replicated for each client.

You can use nodes like:

“Switch has authority” → Checks if the object has permission to communicate with the server and not a remote instance.

“GetLocalController” → Checks to see if the controller owning the pawn/character is from the owning client.

Also you can make sure the communication between client, server and client is setup correctly with the RPCs set appropriately with “Client only”, “Server Only” and “Multicast”.

Without seeing your setup, I wouldn’t know how to advise further.

Good luck.

Alex

1 Like

Thank you so much, function IsLocallyControlled (or IsLocalPlayerController) really seems to be the answer!

1 Like

Ahh. I forgot about “IsLocallyControlled”. Glad you got it sorted.

Good luck.

Alex

Hello. I Am Working On A Multiplayer Project And I Want To Make Interactions With Trigger Boxes And Keys

I’ve Added A Trigger Volume And When I Walk On It, I Want A UI To Be Displayed Only On The Player That Entered The Volume

I’ve Tried Many Things But None Of Them Seems To Work

(The Widget Is Just A Text That Says “Press B To Open Shop”)

The Problem Is That The UI Is Being Displayed On All Clients And Not On The One That Interacted With The Volume, This Happend With Both The Server And The Clients(I Mean When The Client/Server Walks On The Volume The Widget Is Displayed In All Of Them Even On Those Who Are Not In The Volume)

The Programm Is Here

I’ve Created A Gamemode (Simple NOT Base)

And A Gamestate(Simple NOT Base)

And The BP(Of The Create Widget) Is On The Gamestate

The BP Of BeginOverlap/EndOverlap Is On The Level Blueprint

I Havent Changed Anything On The Other BP’s

    https://prnt.sc/11zxyn9 
    https://prnt.sc/11zy06j 
    https://prnt.sc/11zy0s4

Hi, where are you processing the “Overlap event”. On the trigger volume itself or somewhere else?