Destroy Actor not working on the Client

SO, I am trying to destroy the actor after I remove it from the equipment slot.. I made two custom events in my inventory component one is set to run on server and one on Multicast.


then I call the destroy actor from my remove attached Item function.
Now it works on the Server, but nothing shows on the client… Any Ideas?

Hi, if the actor you want to destroy replicates, then if I remember correctly you only need to destroy it on the server and it will be automatically destroyed on the client as well. And if it does not replicate, then you can’t send a reference to it from the server to the client (the reference will/should be nullptr on the client).

One solution would be to make the actor replicate and then only spawn and destroy it on the server. If the actor already does replicate, then make sure you only spawn it on the server and not on the client as well, cause otherwise you will have two actors on the client side.

That worked as far as showing the server remove the item in the client.. but when the client removes the item it doesn’t show on the server?

Replication in unreal only works one way, from the server to the client. So if a client destroys the actor locally it will not affect the server or any other clients.

so, In other words client actions wouldn’t show on the server. but shouldn’t they?

As far as I know the only way a client can communicate with the server is via the RunOnServer event and only from an actor that the client owns. That is a design choice of the engine. As far as the pros and cons of that design choice go, never really thought about it.

its definitely correct or hackers would be destroying actors everywhere :wink:

the missing key may be ownership, since you mentioned destroying an actor removed from an equipment slot, ie an item. the client cant even call RPCs on them because they dont own them.

you’d have to call the RPC from say the controller (client wishes to unequip, remove, destory item etc) and everything from there is handled by the server

sorry I am slow or stupid cuz I am still not understanding how to get it to show on the server. @Auran131 @chrudimer

Really need some help here guys. Give me an example or something

Prop Actor = Simple low data actor in game world (pickup item). Actor is set to replicate.
Real Actor = Full data actor. Actor is set to replicate.

Picking up the actor
Interact → RPC server to attempt interaction
Server Interacts, destroys prop, spawns real item, and attaches to character

Replication subsystem handles you and all your copies getting the actor and having it attached.

Dropping the actor
Input is pressed to drop actor → RPC server to drop
Server detaches the actor, then destroys it.
Server then spawns the prop actor at the characters feet.

Replication subsystem destroys the real actor and spawns the prop actor on all clients.

1 Like

I have it spawning and destroying on the server actor is set to replicate but still not working on the client.. When I pick the item up it both client and server can see it be destroyed if I remove the item from my equipment slot.. the server and client can see the changes if I do it from the server window but If I remove the item from the equipment slot from the client window it does not destroy

Everything has to be done by the server. Never the client.