Download

Problems with UI on multiplayer game

Hi i’m making a TPS multiplayer game with NO dedicated server. I have a working multi game where you can shoot and deals damage to other player and the health bar UI is working good.

Now I would like to create a new widget that it’s created when you deal damage to others and it displays how many damages you did to that guy.

My Architecture so far:

When I the shoot button I call method (Running on server) that calculate shoot information and spawn a projectile. When the projectile collides with a playercharacter it performs some checks and applies damage to it and call a BlueprintImplementableEvent that “should” create a widget on the player that shoot the projectile and display the damage done.

My problem is that this event is called both on Client and Server so if i shoot with 1 guy both sees the damage done by the other. I tried using “SwitchHasAuthority” node but then 1 or another doesn’t create the widget even if they should do it.

I’ve tried to create a MyHUD blueprint class and call a method on it that spawn the widget but i still have the same issue. To be 100% correct i should add that the BlueprintImplementableEvent, called from the projectile when it collides with a player, calls another blueprint Event NOT replicated.

Any advise so make it working ?
Sorry for my bad english, hope i been clear enough to explain my problem.

Hi,

I might be wrong, but I believe you are looking for “RunOnOwningClient”. Make your current server RPC call another RPC which is marked as "RunOnOwningClient, and make sure that is the function that calls the widget initialization.

Hi sorry for the late responses but i’ve been away for some days and I couldn’t test it. I tried as you said created a RPC Client function that calls a method that should display the damage text for the Player. Still no luck it got called both on Server and Clients. If i try using switchHasAuthority node it will display only for Server or Clients and not working for both.

To display the widget I call an event on the HUD created when game starts, is that wrong ?