Replication - Throwing Object

I am actually stuck in my multiplayer project : a bloodbowl like. I can’t make a good throwing ball system.

The first player who picks up the ball: no problem. He can throw it, but problems happen here: the player throwing the ball sees the throw correctly but the other player sees 2 balls and sometimes, none of them are following the same path viewed by the 1st player.

Other problem : The 2nd player can’t pick up the ball (by stepping on the ball and going outside the collision box). Can you help me please ?

Picking up and throwing the ball should all happen server-side.

If you don’t want to implement a complex “client predictive ball throwing” mechanic, make sure to spawn the throwing ball server-side only and replicate its location by making the ball replicated and replicate movement.

If you see 2 balls, then its most likely that one of the balls is the ball spawned by the server and got replicated, whereas the other ball is the one that got spawned client-side.

1 Like

Hello @Zangdai ,
To achieve proper replication, I recommend using RepNotify. I’m not exactly sure how you’re handling it at the moment.

If you’d like, you can share the code for how you’ve implemented the ball grabbing and throwing, and I’ll help you set up the replication correctly so it works as expected on both the server and the clients.

Adding to what @MajorT mentioned,

I would also enable Always Relevant, since this option makes the actor always be considered relevant to all clients, regardless of distance, visibility, or network priority.


I’ll be waiting for your reply!

Server spawns replicated ball.
All players see the ball location.

Player A interacts with the ball to pick it up… RPC server to pickup.
Server validates it can happen and then attaches ball to Player A’s hand.

Player A throws the Ball… RPC server to throw, server destroys current ball and spawns a new one (projectile movement component).

All players see the ball thrown. It goes to the same place on all clients.


You can also do a client-fakey approach to this as well without replicating an actual ball and physics.

Thanks all for the Reply. I did those check. Here a video of the system in game to help how to figure the problem

Thanks. I will share my code of what i did. All the code is in my BP Character (Class Character). The ball is called BP Ball (Class Actor).

Pick Up the Ball :
Function 1 :

Function 2 :

Throwing Ball :

Function 1 :

Function 2 :

1 Like

Hello again @Zangdai ,
I’m leaving you how you should handle the replication topic, with the difference that I already have the the ball placed in the scene, and I throw it when I press a key, which is an Input Action (IA_Throw), because I don’t have the UI system that you have implemented. Also, in this code you’re only allowed to have one ball in your hand, and it won’t let you grab another if you already have one.

First of all, I recommend moving the grabbing and throwing code to the ball. Nodes like Attach, Set Actor Relative, Add Impulse and Detach should replicate by themselves.
Then, in BP_Ball make sure to enable the replication options I mentioned before

and in the Root Component set the collision to Custom, set Collision Enabled to Query and Physics, and enable Component Replicates. Also disable collisions on the mesh (No collision)


Then, to enable and disable collisions, create a bool variable and set it to RepNotify.

After that, you set it to true or false depending on the events, which will be normal Custom Events without replication. In each of those events, create an input of type BP_Character, both to use it as the parent for the Attach and for the direction or force of the Add Impulse.

Next, in your BP_Character create two variables: one bool (bHasBall) and one BP_Ball reference (CurrentBallInHand). Then create two Custom Events with the following logic, which set which ball the character has in hand and whether they have one or not. In this case, the grab ball event doesn’t replicate because the Capsule Component already replicates.

The other event, called Server_ThrowBall, does need to be Run On Server and Reliable, since it’s called through an Input Action and that doesn’t replicate. So in IA_Throw, if the character has the ball (bHasBall is true), you can throw it

And when it’s created in your case , in my case, like I mentioned before, when the Character overlaps with the ball , there you create a Has Authority so it’s handled correctly. (This Has Authority is used to make sure that logic runs on the server side, which is the one that has real authority over replicated actors. This way you avoid possible issues if both players try to grab the same ball at the same time). So only if it has Authority do you allow the character to grab the ball, and only if they don’t already have one in their hand.

I’m also leaving you some documentation that might be useful for you

Let me know if it worked for you, and if not, I’ll see about creating a simple UI to help you get it working.
Happy coding!

Thanks a lot ! I will try this and adapt it to my project!

I will share update and progress

Hello, i’m back. I have a new problem. I can correctly grab and throw the ball with the first character of the first player, but after that, the next character (still the same player or 2nd player, the result will be the same) if i grab the ball, the ball is not set on the socket location, but on the ground in a certain distance. The ball still follow the character but is on the ground. I don’t understand why

I think the issue might be that the Root Component of the ball Blueprint isn’t replicating correctly.

Do you have replication properly configured for both the actor and the root component?

If the above is correctly configured, could you send me how you currently have it set up so far? That way I can review it and see where it might be failing.

Thanks for your time. Sorry for the time i take to answer, got some problems with my PC.

So, first of all : the replication parameters for the BP Ball :

Functions of BP Ball :

Player Controller is my personnal PlayerController i made, called “Bp PlayerControllerMultiplayer” . The “Selected Location” store where i clicked with my mouse (used to move character) and is here :

The ‘selected character” variable is the character i clicked on with my mouse

OnRep_IsGrabbed :

BP Character Functions :

Now, what happens in game :

Sorry for all of this, i hope this is understandable

Try setting the collision sphere as the Root Component. It’s very likely the issue is happening because the current root isn’t handling collision properly


(Quick note: the Blueprints aren’t clearly readable in the image)