How to get the local (my player) player

So I have the third person example and I wanted to debug print a text to the screen when the game starts (beginplay) - I figured I could use the Is Locally Controller or Is Local XXX and then branch… and if so print.

However I get prints for all connected players and not just mine. why is this? and how can I avoid this - my usage would be checking for the ‘players’ player and wanting to attach something or perform an action on it.

Hey @xxsemb
Are you seeing this in editor? Is normal in editor see the prints of each client.

You may want to see a build.
Is the game based on a dedicated server or is a listener server?

Print string will print on all clients. Normal behavior. You need to go through the UI to print for a specific connection.

If I’m not mistaken you can just use the get player controller with index 0. It should return your local player’s controller since the client doesn’t know about other player controllers.

Couldn’t quite get your usage. Can you clarify on that and give a little more detail?

Note: The index on the GetPlayerController node is for Local Multiplayer Games. There are different functions for checking how many player controllers are created.

As others have stated the print string runs on all clients because all client’s trigger Event Begin Play. I believe you would see it all gets their own player controller by randomizing the print string Text.

I hope this helps. I might be rusty on blueprints since I have been developing a custom editor tool plugin for a while now.

more specifically BeginPlay runs on everyone.

there is no ‘mine’ even the server is a player. but if you mean the server you can use SwitchHasAuthority or IsServer

This is generally used for Single Player and COOP (split screen). There’s no way to guarantee the connection order. For example On initial game load the host is typically 0. While all other connections are indexed by On PostLogin order.

During server travel (map change) the index order can change. A connected player can be set to 0 while the host is 1.


Print strings are loaded to each screen regardless of what client called the print.
Player 1 will display Client 1: text to display
Player 2 will display Client 2: text to display
Server will display Server: text to display

A simple example is to set up an input that prints to string the Location vector of the client pressing the input.

This will print Client 1: x nnn.nn, y nnn.nn, z nnn.nn on every clients screen.

Regardless of using any level of flow control… switch has authority, is locally controlled, get local/network role, is server etc.

PrintString prints to ALL Screens.

Thanks all, will try this now I am back for a day.

Thanks for clearıng things our for me too. It has been years since I touched the online gameplay code. I might remember it wrong but the player controller 0 on the client should be the local player controller. I also why added the check for I Local Player controller.

I understand you replied to the Index On The Get Player Controller part of my reply. But it made me wonder if there was anything wrong about my answer. If there is I would really appreciate if you can point it out :folded_hands::folded_hands:

When testing in the editor… Play In Editor (PIE), anything printed for any player regardless of flow control will be printed to all screens.

If print string worked in packed builds the text would only be printed on screen for those that executed the code. Take my previous post example. In the editor testing (PIE) there’s 2 windows (screens). When client 1 presses the input it prints the vector, but also it prints the vector on client 2. The editor denotes which client/simulation the code command was executed on via the client1, client2, server prefix. In a packaged build it would only print for the client that pressed the input.

So regardless of who executes or where it’s executed it will print on all screens when in PIE.
Begin Play, Construction, Input, tick etc.

With your specific example only the Autonomous Proxy for each client would execute. Sims and Server would be skipped. If you remove the branch, then all proxies for each client would execute and you’d get an odd result in the prints.

For Sims, Player Controller 0 is Null because the server does not replicate controllers.
For the Server, Player Controller 0 is typically the host client.

Say there are 3 players. Youd get 3 Autonomous Proxy prints that look good. Then you’d get 3 Simulated Proxy prints missing display name. And then 3 Server Proxy prints that use client ones controller display name.