I’m more of a fan of melee-oriented games myself. In this instance, a projectile served as a clearer illustration of the replication process. Much easier to tell what’s going on when you’ve got a spawned object to work with.
To handle a melee attack, when you fire the weapon, you play an animation montage and use an animation event to trigger a hit box associated with the weapon or run a box trace. In either case, you find overlapped opponents, then cause damage to the valid targets.
It is very likely you want your hit box to be “active” for longer than one frame. This would potentially cause actors caught in the box to be damaged every frame. So, you build a list of hit targets, and exclude anybody from being added to the list if they’re already in it. If you want a melee hit to deal damage multiple times during an animation, like with certain fighting game bosses (Justice from Guilty Gear comes to mind), you can clear out the list of hit targets to refresh it and allow the attack to damage actors again.
To handle this over a network, it’s necessary to trigger the same anim montage for the attack both on the server and on the clients. The Gameplay Ability System has features built-in for handling this process, and in the Character Movement Component we detail how root motion replication and root motion sources are handled, enabling you to create complex movement. Otherwise, the process for registering hits needs to occur authoritatively. Some client-predictive logic may be required depending on your needs for responsiveness or variety in melee attacks, similar to what Victor and I discussed for client-predictive projectile firing.