# How can this player controller client function get the gamemode?

**URL:** <https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771>\
**Category:** C++\
**Tags:** UE4-25, unreal-engine, question\
**Created:** [January 16, 2022, 6:27am UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771 "2022-01-16T06:27:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [January 16, 2022, 6:27am UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/1 "2022-01-16T06:27:19Z")

</div>

This is some blueprint from Unreal’s multiplayer shootout demo which I’m trying to replicate in C++. How does this work?:

 ![Capture](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/1/71f7f7a1c3dd21ec00e6bce01aa97ec5da25bc84.png)

A client function called in the player controller class.

I thought that clients can’t get the gamemode, so “Get Game Mode” should fail. Why doesn’t it?

Edit: [the link to the demo I’m talking about.](https://docs.unrealengine.com/4.27/en-US/Resources/Showcases/BlueprintMultiplayer/)

---

<div class="post-metadata">

**Author:** ![Lardo\_Deepdelver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lardo\_Deepdelver](https://forums.unrealengine.com/u/Lardo_Deepdelver)\
**Post date:** [January 16, 2022, 10:45am UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/2 "2022-01-16T10:45:57Z")

</div>

k, this confused the hell out of me for a second,  
the answer is it doesn’t  
Cast to MyGameMode fails and respawn player event is never called

the second player is just spawned over the default player spawn mechanic  
try to disconnect the second player spawn in Respawn Player Event

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/2/3227501872fca74fe886d80e6c433313664ef9c1.png)  
and the second player is still spawned

---

<div class="post-metadata">

**Author:** ![eblade](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eblade](https://forums.unrealengine.com/u/eblade)\
**Post date:** [January 16, 2022, 7:18pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/3 "2022-01-16T19:18:34Z")

</div>

Isn’t ClientPostLogin called on the Server side, from the Client?

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [January 16, 2022, 7:39pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/4 "2022-01-16T19:39:40Z")

</div>

Client post login isn’t an overridden function.

---

<div class="post-metadata">

**Author:** ![Samathan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/samathan/32/1058905_2.png) [@Samathan](https://forums.unrealengine.com/u/Samathan)\
**Post date:** [January 16, 2022, 7:56pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/5 "2022-01-16T19:56:19Z")

</div>

Huh… well that’s… weird. Guess there’s something else wrong with my project. Thanks!

---

<div class="post-metadata">

**Author:** ![eblade](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eblade](https://forums.unrealengine.com/u/eblade)\
**Post date:** [January 18, 2022, 9:47pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/6 "2022-01-18T21:47:59Z")

</div>

actually, you’re right. that does feel weird. it’s calling a reliable server function inside gamemode, but since gamemode doesn’t exist on the client, how _does_ that work?

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [January 18, 2022, 10:30pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/7 "2022-01-18T22:30:48Z")

</div>

Unless the event also fires on the server, then it doesn’t work – it’s dead code.

Start it, put a breakpoint there. I bet it either doesn’t fire, or it’s invoked on the server.

---

<div class="post-metadata">

**Author:** ![User-400315961](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/user-400315961/32/899372_2.png) [@User-400315961](https://forums.unrealengine.com/u/User-400315961)\
**Post date:** [February 20, 2025, 9:07pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/8 "2025-02-20T21:07:02Z")

</div>

Hey, sorry to necro, but I was quite intrigued by your comment.

Is there any way to make the server tell a client to execute something?  
I have the opposite situation of OP, where I want my game mode to tell each client to run a “kill player” function in their player controller. I’ve found that this gets skipped for all clients that aren’t the listen server owner.

The issue is quite obvious, as you stated, the context is wrong. But there does not seem to be any way to get the context right? Server to Client RPCs are unusable in most sane scenarios because then can’t then make Client to Server RPCs back. It’s hard to figure out how exactly to handle this, routing the function call via the game state seems like the most reasonable approach, but this should still cause the context to be wrong, right?

Update: repnotifies.

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [February 20, 2025, 10:43pm UTC](https://forums.unrealengine.com/t/how-can-this-player-controller-client-function-get-the-gamemode/272771/9 "2025-02-20T22:43:44Z")

</div>

> [@User-400315961](#):
>
> Is there any way to make the server tell a client to execute something?

You either invoke a “run on owning client” event on the PlayerController of the client in question, or you invoke a “broadcast to everyone” event on some object that every client sees.
