How can I set the specific attribute of the BP on Server?

I’m trying to build a Pick Up Actor System that support multiplayer game.
I think I have mistakes about change the attribute’s value of a component in BP on server and what I have tried is following:
BP_BaseCharacter has a StaticMeshComponent with no static mesh

Pick works well and the problem is Set Static Mesh of “On Projectile Picked”

Set Static Mesh didn’t work on Client, and there is a similar situation about Launch a Item.I make both Item and Projectile in BP_ItemProjectile.
The BP_ItemProjectile has a boolean RepNotify attribute “Is Projectile”.And the ItemProjectile(Projectile Movement Component)'s Auto Activate is off.

Now the result is Set Static Mesh( two pic. upper) and Activate Item Projectile( two pic. under) isn’t work:

Ok so, first of all, you are setting the Static Mesh only on the Server. This is not replicated by default.
To set that, you have two ways:

  1. Use a Multicast Function, which has the StaticMesh as an Input and set the Components StaticMesh with that.
  2. You call the Multicast in your “OnProjectilePicked” instead of the current setting.

So it would be ->CastToCharacter->Multicast_SetStaticMesh(StaticMeshToUse)
And in the Multicast you directly call “SetStaticMesh” on the Component.

A multicast is called on all instances, so even on the Server.

OR

  1. You create dummy StaticMesh Variables and set it to “RepNotify”.
  2. Now, inside of the OnRep function that gets generated, you set the StaticMehs of the Component to this replicated variable.
  3. In the “OnProjectilePicked”, you now only set the Variable variable (need to be on the server).
  4. Then the OnRep will get called and does the rest.

In BPs, OnRep gets called on every instance. That’s a difference to C++, where you need to call it extra for the server. Just so you know for the future.

For he second problem, you might want to remove the extra Server call. You are already “Multicasting” with the onrep.
Not need to move all calls back to the server.

OK, I find the problem is I close the Auto Active of the BP_ItemProjectile’s Projectile Movement Component.I use “Set Active” before I Spawn the BP_ItemProjectile Actor.

Sorry for using Chinese, event “ProjectileOnServer” is only on server, and the"分支"is branch.The fact is the Actor’s Movement Component works perfect on server but only have 1 frame on client, and it’s really work on client, I can see the effect on the wall and before the Actor destroy itself (plan in the bp) it only has 1 frame…