By the way, this is the visual representation of the default hitboxes per Stefan's formulas:
Each color represents a direction.
However, it's actually the reverse of that image. Detection checks if you're in that area of
other players while they are swinging their sword(player.ani == "sword"/player.sprite in |9,13|). So you only get hit if
you, or your client, finds yourself in that hit range of another player, instead of checking other players in your sword range.
This means if there is lag, one of the players isn't getting ani/placement updates as often as the other meaning they may not be registering the same 'hits' that you are seeing.
In your case, you see him camping in the corner. You move in to hit him but you can't quite reach him... but he can't reach you. You inch further to swing but suddenly you are hit and he isn't! What happens is while he's camping in the corner, his movement is the same. You inching in means your client, being smoother for you in this situation, registers his sword swing as hitting you. However for him, since you or him may be lagging, your movement isn't smooth to him, thus his client doesn't immediately register you(thus your swing swing) in the range before his hit registers on your side.
This is all just me making assumptions, though.
edit: