There are two castles. When the player clicks on this castle, I try to change its color. When the server clicks, the color of the castle changes, but when the client clicks it does not change on the server. I connected it to begin play to control events. It works. But when clicked it doesn’t work.
RunOnServer events will only be replicated from client to server if the client is the owner of the actor.
Owner is specified when spawning the actor, or can be set at runtime via SetOwner (on authority side).
Level-placed actors/blueprints never have a player as their owner, thus it’s not possible to do client->server replication on them.
To work around this kind of problem, you can route the click to the server via an RPC in your PlayerController (can work in Character or PlayerState as well). Pass a reference to the castle actor as a parameter, so you can call Castle->SetMat from the PlayerController’s RPC.