is probably right. Check if the player character is local. Since one of players is the server(?), things might be replicating weirdly. Have a read through here.
What do you mean with “Check if the player character is local”?
Your player may not be existing where you think it is. It may be existing on either the server or locally (on the client) or both. You may have the player existing twice, which as said, is resulting in extra widgets being created. I couldn’t find the docs where I had originally read about this.
Yeah but how do I check that?
I haven’t done much with networking (only the theory), and I couldn’t find the docs I had last time. I’ll have more of a search around now.
Try asserting that your player is local before rendering the text using APlayer::IsLocallyControlled.
I put a GEngineDebugMessage if the player is locally controlled. When I run the game, both client and server show that message.
So they are both locally controlled.
Also, do you see “Client” and “Server” texts on the top-left of the screen?
In the BeginPlay I added the following function:
If you are a server, print “Server”… if you are a Client, print “Client”
From the first screenshot you can see that those messages get printed out more than once…
That is exactly my point. Those messages are repeated multiple times because there are duplicates of the players on both the client and server due to replication. The local check should be used during the text drawing call, as the “duplicate” players will also have the event called. Using the check though, only one of the players will draw to the hud, the local one.
Ok done but now:
When the Client kills the Server, the Client sees “YOU KILLED…”, but the Server DOES NOT see “YOU WERE KILLED BY…”
And vic eversa when the Server kills the client…
Where is this code located? If it is in your player’s code, the PlayerHit is not going to be local, so check for it not being locally controlled instead. If it is in your game mode, the server may not be viewing its player as being local.
It’s inside the Weapon Class (inheriting from Actor). The weapon performs a RayCast and PlayerHit is the Character hit by the LineTrace.
Try adding a not operator before PlayerHit->IsLocallyControlled(). You want it to hit the the other player, the one NOT on the client.
That didn’t solve the problem <.<
Is it still the same? The server doesn’t see text, only the client?
Actually I found a collaborator who’s helping me on the Networking side of the project.
We’re now supposing there’ll be a Dedicated Server for the game, so we test our game by running 2 client + dedicated server.
Anyway, even with the clients, if one kills another, the “Killer Client” will see both messages…
Using if (!PlayerHit->IsLocallyControlled()) before your draw call should make it impossible for both messages to be displayed on the same client. If it isn’t making a difference, then it should be safe to assume the problem is not occurring that section of code.
PS: I did find your earlier thread, and saw you had uploaded your project. Sadly though, I don’t own Windows, so I couldn’t have look through it.


