# Custom Event 'Run on Server' does not work

**URL:** <https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268>\
**Category:** Blueprint\
**Tags:** custom-event, actor, rpc, unreal-engine, Blueprint, question\
**Created:** [November 12, 2015, 3:26pm UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268 "2015-11-12T15:26:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulianS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JulianS](https://forums.unrealengine.com/u/JulianS)\
**Post date:** [November 12, 2015, 3:26pm UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/1 "2015-11-12T15:26:59Z")

</div>

Hi,  
for an online RTS I am trying to Spawn Buildings.

In my ‘PlayerController’ I spawn an Actor from type ‘ConstructionManager’ with the PlayerController as its owner.

On ‘BeginPlay’ of the ‘ConstructionManager’ I do ‘EnableInput’ for it with its owning ‘PlayerController’ as input source.  
When pressing ‘H’ the ‘ConstructionManager’ should call a CustomEvent with ‘Run on Server’, which should then execute a ‘Spawn Actor of type’ Building.

But the CustomEvent never triggers.  
In the docs it says

> 4.If the RPC is being called from client to be executed on the server,  
> the client must own the Actor that the  
> RPC is being called on.

So what exactly is meant with owning? As i said my ‘ConstructionManager’ is owned by ‘PlayerController’ isn’t this enough?

 ![66537-unbenannt5.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/1/051579c1a3145e0480f74f81e4f746bbdfa40199.jpeg)

---

<div class="post-metadata">

**Author:** ![JulianS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JulianS](https://forums.unrealengine.com/u/JulianS)\
**Post date:** [August 21, 2016, 12:34pm UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/2 "2016-08-21T12:34:10Z")

</div>

I figured it out by myself.  
If you want to use a CustomEvent(replicated by server) you have to make sure that the Blueprint is only spawned on the server and then replicated. So you have to use an “AuthoritySwitch” and plug the Blueprint to “Authority”.

If you don’t explicity spawn (in my case) “ConstructionManager” on server with the “AuthoritySwitch” it will be spawned on the client and the server. The server then replicates it to client which means you do have to copys of “ConstructionManager” on the client then. The problem is that the original version of the “ConstructionManager” on the Client gets priority and does not have a verison on the server. So it is not able to Call a Function on the Server.

To put in in a nutshell:

If you want a Blueprint to be able to perform “CustomEvents” with “Replicate on Server” you have to make sure that it is only spawned on server. Do this with an “AuthoritySwitch” before Spawning it. Then make sure to set “Replicates” in the Blueprint settings.

For more details see:  
[http://cedric.bnslv.de/Downloads/UE4\_Network\_Compendium\_by\_Cedric\_eXi\_Neukirchen.pdf](http://cedric.bnslv.de/Downloads/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf)

---

<div class="post-metadata">

**Author:** ![ENiari\_Games](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ENiari\_Games](https://forums.unrealengine.com/u/ENiari_Games)\
**Post date:** [July 12, 2017, 4:07pm UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/3 "2017-07-12T16:07:18Z")

</div>

Hey broskies, your link to the pdf is dead.

---

<div class="post-metadata">

**Author:** ![JulianS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JulianS](https://forums.unrealengine.com/u/JulianS)\
**Post date:** [July 12, 2017, 4:50pm UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/4 "2017-07-12T16:50:11Z")

</div>

> **[UE4\_Network\_Compendium\_by\_Cedric\_eXi\_Neukirchen.pdf](https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf)**
>
> 1622.40 KB

this should work

---

<div class="post-metadata">

**Author:** ![peteSchmidt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@peteSchmidt](https://forums.unrealengine.com/u/peteSchmidt)\
**Post date:** [August 5, 2022, 11:21am UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/5 "2022-08-05T11:21:38Z")

</div>

Hi,

what do you mean with “Span Blueprint only on Server”? I have the exact same problem here: I have put a blueprint in the scene, which has a light and a boc collision. When a player enters the box, it can press “E” to switch the light on and off. The problem is, that it is only visible on the client and my custom event, that should execute on the server just dont work.

---

<div class="post-metadata">

**Author:** ![peteSchmidt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@peteSchmidt](https://forums.unrealengine.com/u/peteSchmidt)\
**Post date:** [August 10, 2022, 10:45am UTC](https://forums.unrealengine.com/t/custom-event-run-on-server-does-not-work/338268/6 "2022-08-10T10:45:01Z")

</div>

SOLUTION:

The Problem was, that in this moment, when I enabled the input, the blueprint was kind of running on the client. But when I said RPC-\>Run on Server, this doesnt work, because the blueprint itself IS (!) running on the server and the command wasnt executed. So the solution is, to Own the Actor, the blueprint is running on, by the player character and then execute an RPC-run on server. I hope this helps
