Download

Running a action interface from clients to server?

I have a inventory system, where I use a action interface from the hud when a item is “used”.

Here’s a screenshot from my hud blueprint where the action interface is called.

It calls over to the item being used, and should execute a short “script” there. However, when a client attempts to use the item, it only executes on that client.

Here’s the part that receives the action interface execution flow inside the item.

I’ve tried creating a custom event behind the action interface with “executeson server” replication like this with no luck. This still only gets executed on the client side of things. I’ve tried with multicasts as well with the same results for some reason.

Is there any way to get a action interface which exists on a client-side hud, to execute on a server-side object?

I’ve tried googling replication of action interfaces and I only find people asking the same question, without clear efficient answers.

It seems weird to me that this wouldn’t be replicatable :frowning: seems like it would be such a useful feature to have. I must be missing something.

You should separate “client wants X to be done” from “server wants X to be done” in the object logic.
When the GUI tries to run the action, the object should send that as an event to the server (“run on server” for an event, for example.)
The server should then verify that the thing happens, and then broadcast to all clients, including the client that requests the action.

Thanks for the reply.

So something like sending the flow over to the playerstate, and executing the action interface there should work?

Only the owner of an object can execute a server RPC.

So the playercontroller or controlled pawn can execute on server.

The inventory items are probably owned by server.

So when button clicked, execute event on server and pass the inventory item to it.

Then in server event, call the interface on the inventory item

Greatly appreciate the help guys. Got everything working perfectly :slight_smile: This replication stuff gets a bit confusing at times.