MP Client spawns 2 projectiles

Hi there. I’m trying to create a spell system.
The projectiles fly, do damage. Seems to replicate correct.
The only issue is that clients spawn 2 projectiles.
Sometimes they are right on top of each other. Sometimes one is a little behind and sometimes it doesn’t even move and damages the caster.
What I’m doing is, I have a anim notify and once you reach that point in animation it casts to character and runs an event (run on server) that spawns the actor.

Hi whatevermate

Check to make sure the Server event is called from authority. It is probably the case that both instances of the same actor are calling your logic.

For example, lets say you have two clients connected.
Player 1 will get its pawn, however, another instance of players 1’s pawn is spawned on the second client, meaning that there are essentially two pawns for player 1. When you check authority you are ensuring that only the pawn instance on the authoritative client (a bit like the owning client) is calling the server event.

Hope this makes sense.

Alex

Thank you so much. I have no idea how I didn’t think about this myself. So I created a new event that checks for authority and then only if there is an authority it proceeds to an event that spawns the projectile. Thank you very much.

Glad you got it sorted.

Good luck with the rest of your project

Alex