Client Call an Event on an Unowned Actor

I’m trying to build a multiplayer game that allows players to open a door when they click on it. Here’s my code.

May not be the best for optimisation right now but that’s an issue for another time.

Currently the door opens on both the server and the client, allowing both to walk through. But it only does this when the server clicks on it. The ActorOnClicked event is run when the client clicks on the door, but the ToggleDoor event it not.

My understanding is that this is because the client doesn’t own the door actor, so can’t call a function on it. I don’t want to have to spawn every door for every individual client, partly because this makes level building difficult and because I think I’d be throwing any replication of the doors in the bin.

I’d appreciate any suggestions for solving this issue.

I’m still new to multiplayer programming and this is an attempt at learning some of the basics. I’d be very grateful for any assistance.

To make a successful client-to-server RPC (execute on server node) happen it must be called from within the blueprint of a class that is part of the connection-owning hierarchy, such as a playercontroller.
Doing it from a blueprint that is not will unfortunately silently fail.

So usually I will have playercontroller get the Game state and use that to call the event on Server. So it runs on the server’s gamestate and from there it finds the door actor and tells it to move.

The trick is going to be finding the door actor from within the gamestate to tell the door to either multicast or set repnotify the door open boolean variable (either of those methods will cause the change on all clients).
This is where it comes in handy to set Tags on your actors placed in the level because then the server rpc event can do a GetAllActorsWithTag using a string or Name fed into it from the event node (you can add parameter variables to those to send information through) and just Get index 0 from the array that GetAllActorsWithTag node returns.

As for telling your timeline to play AGAIN every frame, 60 times a second, I think there are better ways but the networking is the tricky part so I focused my answer on that.

Thanks for that. I’ll try and see if I can get it working through a game state. And yes, I agree that calling the timeline on a Tick event is a terrible way of doing it. I originally wanted the timeline to run at the end of the ToggleDoor function but for some reason it didn’t allow the door to open on the client. It was just a quick fix, really.

Hello, RPC functions should only work on actor classes, maybe also on actor components not sure right now. Is your AnimationHelper also derived from the UObject class, I wouldn’t know how that can actually work in networking. So simple solution just move your code over from the helper classes to the character and player controller class. If you want helper classes to outsource some functionality I would advice you to use components instead of uobjects anyways because that’s how the framework is meant to be used, allows you to customize the components in blueprints for example. Usually a good approach in terms of networking is to give the clients as little control as possible and minimize network traffic, if you have client side hit detection run a server RPC on the character that the player hit something, the server then applies damage and calls a multicast RPC to let all clients know they need to apply damage locally as well to trigger the recoil animation. Also your RPC’s are a little bit too universal in my opinion, I would rather have RPC’s like ServerSwingSord and MulticastSwingSord, that way it is easier to avoid malitious data sent from clients and you reduce the data amount for every RPC quite a lot.


It sounds like the issue you’re facing is related to ownership and replication in a multiplayer game. When the client clicks on the door, the ActorOnClicked event is triggered, but the ToggleDoor event is not. This is likely because the client does not have ownership of the door actor, so it cannot call functions on it.

To solve this issue, you can try using RPCs (Remote Procedure Calls) to execute the ToggleDoor function on the server. This way, when the client clicks on the door, it can send a message to the server to toggle the door, and the server will execute the function on the door actor.

Here’s an example of how you can do this:

  1. Add an RPC function to your door actor that will execute the ToggleDoor function.
  2. In the ActorOnClicked event on the client, call the RPC function on the server and pass in the door actor as a parameter.
  3. On the server, receive the RPC function call and execute the ToggleDoor function on the door actor.

This way, the client can still interact with the door and toggle it, but the function will be executed on the server, ensuring that the door is only opened for the player who owns it.

I hope this helps, and congratulations on learning the basics of multiplayer programming! By the way, I achieved this on this website