How to spawn actor from client and replicate it?

I’m trying to learn some networking, I’ve watched the Unreal networking tutorials, but I still can’t accomplish a very basic task:

If client presses a key to spawn an actor, it spawns and is visible on all other clients & server.

This is what I have so far:
96836-
… But this works only when server presses the key - in this case it shows up in all clients. But when one of clients presses a key to spawn an actor, it shows up only on the client who presses it.

The ‘Replicates’ checkbox is checked on the spawned actor.

I feel like I miss something basic, maybe my brain really doesn’t like networking :frowning: Any clues?

1 Like

Here is how you should go for what you want to achieve:

  1. The client presses the key and call a server RPC function/event
  2. In this server RPC, you spawn the new actor
  3. It will be automatically replicated to other clients

In your actual blueprint, your Spawn It event should be a server event. Right now I think you setted up as a multicast event, which only servers can execute. That’s why it only works on server.

Good luck !

1 Like

Thanks! I’ve changed it to server event, but it still works only when server presses the key. Here is how it looks:

When I press ‘2’ on server, it spawns it and shows on both server and client.
When I press ‘2’ on client it does nothing. But the ‘Hello’ string works, so it responds to input correctly.

Probably is Spawned, but on world location 0,0,0? I had the same issue.

Make sure you set the network ownership correctly on that actor of the blueprint you show

Did you try to put this blueprint somewhere else ? Usually, this kind of network stuff is done in a PlayerController.
I’m not sure if clients can do much on Level instances.

I’ve moved it out of level blueprint and it worked! :slight_smile: So that was the cause, things like this won’t work in level BP.

Thank you, +1’s for you all!