HitEvent not running on server

Problem: Server often does not trigger OnHit events when running in dedicated mode (PIE, even with dedicated checkbox works perfectly). I have been at this for two days and I reproduced it in a fresh projects - steps below.

Basically, I’m shooting projectiles (spawning on a server, reliable RPC) and giving them a velocity/physics. My current setup is, the projectile has an OnHit event and when it hits something, it tries to cast it to a character and if it succeeds, it calls the TakeDamage RPC on it, after which (regardless of the cast), it shows a particle effect and is despawned.

In PIE, this works perfectly with 2 players and dedicated server ticked. When I build a dedicated server (windows or linux) and connect to it with two clients, then the projectile SOMETIMES (not always, just often) just goes through the player and hits the wall just behind it. Server gets no OnHit event (actually, I sometimes see an out of bounds event since the projectile just flies forever).

Am I doing something wrong?

In order to reproduce it, you can use the setup below.

Setup:

  • [C++] Third person template
  • Create new Blueprint “projectile”; set it to Replicate (incl. movement, always relevant)
  • Add a simple sphere mesh to the default scene root, simulate physics, disable gravity, enable collision hit events
  • Add this to its event graph

  • Add new input binding “Shoot”
  • Go to ThirdPersonCharacter blueprint
  • Add this to its event graph

EDIT:

Observed behavior: when you start dedicated server and a couple of instances of client and shoot the projectile, you will only sometimes see the log print string in the server’s log.