How to make the Server change a replicating actor from Client (SOLVED)

This is a newbie question for networking, I believe.

I have a decal in the world. It’s replicating
Server can set visibility on and off and it replicates to clients.

I want the client to ask the server to show the decal when client presses M

When I press M on Server the grid appears.
When I press M on Client nothing happens.

What am I doing wrong?!

Hi, only the owning client can call RunOnServer events, if any other client tries to do so nothing will happen. And there can only be one owner at a time and the owner needs to be set from the server. So if you would need several clients to be able to call RunOnServer events on an actor, then that’s not possible and you will need to do it differently.

Hi, Thank you for the fast response!

I think I am having trouble understanding ownership then.
The logic in the two pictures above is in the Player Character which is used by the Listen Server and by the Clients alike.
Wouldn’t that make the Client an owner of the reference to the grid as well? And even if not, wouldn’t the Client be able to communicate with the server with a Run on Server event?

I tested this

I pressed M on the Client.
So the event chain made it to the server and the server did change the variable. But the Rep Notify did not change the grid visibility.
When I cast to Grid_Blueprint, the cast fails.

Sorry I thought the two images where from the Decal Blueprint, I should have looked better =)

The possessed pawn is owned by that client, so the RunOnServer event works there.

When I cast to Grid_Blueprint, the cast fails.

Can you show how you set the “World Grid” variable?

Just replicated. But honestly I think I shouldn’t even need to do that. If the decal sends his reference at begin play, then each client should have their own reference right?

The only things I should be replicating is the Grid Visibility boolean and the decal actor itself.

This is the logic on the Decal Actor

(The decal component replicates as well for good measure.)

In this case I run Queue Grid on server because, since the decal itself replicates, all I need to do is change its visibility on the server.

Sorry I am having trouble wrapping my head around these concepts still…

Tested: Yep the same logic still works if I run it from the server even if queue grid and world grid are not replicated. The reference is still only created on the server and not on the client. Which is fine. Now how do I get the server to show the decal?

Lol seems something so simple…


It was all on the Rep Notify.

The problem was that I was using the local variable on the client which was never set in the first place!

Once I check for Authority, I grab the character of the Server, cast to the character to get the Server’s variable, THEN IT WORKS!

Wow… I feel my brain all twisted right now.

Now when I press M on the client the grid appears on everyone. awesome.

Thank you @chrudimer for helping me!!!

1 Like