Download

How to ask server to destroy an actor?

I have a function for destroying an actor. The problem is that only server can do it, but client can’t. Is there any logic that makes client ask server for destroy an actor? If it exists, can you show me?
Sorry for my bad english.
​​​​​

Hi
I assume you have a Playercontroller and Gamemode setup??

In the Gamemode do this…

Create a CustomEvent. Mine is named KillPlayer…

Click on your custom event and set it like so…
Note that the Input which I named controller is an Object of type PlayerController. It is NOT your player controller blueprint.

GameMode2.PNG

In PlayerController do this…

Create a custom event… mine is named ServerKillPlayer

Click on your custom event and set it like this…

Controller1.PNG

You can test it by putting this in playercontroller… Pressing K in a client screen should kill that player.

Please note that I am still a UE4 noob… so this might not be correct or the best way to do it… but it seems to work OK :wink:

Thanks. I wanted to destroy a game actor (in my case that was an item for inventory), not a character. But your node setup was useful for me and now i figured out how to destroy actors. I did not know that i can use run on server for custom event. Thanks for a good example.

Glad that it was of some help