Lag compensation

So I’ve been working on a projectile replication system, that uses Nevermore’s clock syncing module to compensate for the lag between each client and it works perfectly.

However, there is one thing I’m trying to figure out. On the client, when you are moving and someone shoots a projectile at you, because you’re position on the client and the server is different, sometimes it can look like the projectile completely missed you but you still took the damage.

Does anyone have any ideas or solutions to get around this?

There’s two solutions I thought of.

Firstly, you create the projectile trail or impact on the client and move it accordingly with the clients input. For example, Player A shoots their projectile at Player B, the server gets fired, sanity checks to make sure they’re not exploiting, blah blah blah, then the server fires arguments to all clients with two arguments, the part where the projectile trail starts and the next where it ends.

If Player B is 5 studs away, on Player B’s screen you will just subtract the differences and angle the trail accordingly. Then on both screens it will show that they hit and then you register damage accordingly. The downside to this is that if Player B is behind a wall, there’s really nothing you can do because you’re at a crossroads situation. Do you damage Player B for being laggy? Or do you make your game look bad because it’s letting (not really letting, but showing) players shoot through walls.

Second solution is just to keep it how it is. By far easier than the first solution. Players realize that they don’t have the best connection. Every game struggles with lag because many Roblox players don’t have NASA internet.

You could do solution one but then delete the trail if it’s going through a wall. They’ll still take damage (Because they should) but you hide the fact that they’re lagging.