How to use APlayerController::ClientMessage?

To be able to send custom messages depending on if an actor role is authoritative ot not I found this function ClientMessage(). In the docs, it says it is outputting the message to the HUD, but I am unable to get this working. I even created a custom empty HUD blueprint, but nothing is really displayed there.

Has anyone an idea how to make this work?

This is covered in the course but not using ClientMessage. There are ways for clients to call methods that run on the server and there are ways for the server to call methods on a client.

I’ve never seen nor used ClientMessage.

Yes I think you are referring to RPCs, but I was more interested in the usage of this specific function. I literally couldn’t find anything useful about it, other than what the documentation states that it “outputs the message to the HUD”. What does that mean? I also checked if the HUD class maybe has some kind of callback to use these messages, but couldn’t find any.

HUD is a specific object type linked to a UI widget. It can be set up in the game mode so if that is what it relates to, it probably isn’t anything relating to multiplayer but rather a mechanism for displaying messages to the player controller. If you were using split screen this makes sense. RPCs would be the normal way of communicating between clients and servers.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms