How to change button visibility on server from client?

I’ve trying to learn a Networking with blueprints (replication, client/server and etc).

I’ve made UMG Widget, there was no Owner, I saw the buttons on Server and Client.

I wanted to make one thing -
When on server pressed a button on the screen, this button on client disappear (it works) - multicast way.
But when I trying to press button on the client, I can’t get a button disappeared on server.

Please, help, how usually people make this?

What you need to do is create a function marked as Server. This is how the client gives commands to the server. Once the server receives the command it can call the same multicast you mentioned and it should work.

You mean the event marked with “Run on Server”??

Yea you should be able to mark an event as a Server event with that.

ok, that’s clear
but if client won’t own the target (if I understand right), function won’t work,
and my mind is blowing there.
Can you show me an example?

Unfortunately I am on my phone so I can’t provide any examples. But overall, remember that stuff like pawns, the gamestate and your controller exist on the server. If an event is marked with Run On Server it won’t execute on the client only on the server.

The caveat is that UMG is client only. So what you would do is e.g. have an event in your game state called “UpdateButtonState” marked as Server. You’d run this from your client and it would fire on the server. From there on you can fetch the widget and update it (all of this will happen on the server only).

Ok. got it.
It’s worth trying, maybe you’re right

Ah, can’t get through it(
Thought about this:
in Widget Blueprint

100796-1.jpg

in State Blueprint:

Maybe casting could help, but I don’t know…
You said that UMG is client only?? you mean, there need 2 UMG’s?

I tried it on PlayerController (on GameState it should work too, i suppose), thank you!
Make a Widget in PC, then launched an “On Server” event to make button hidden, and it worked. I don’t know is it a common idea, anyway