I think a much simpler way than checking position every so often would just be logging the player position every time they attack alongside with a timestamp.
Clear this log when they die and every time they attack just check if the time from the last attack is both between a certain threshold and if the distance from the last position they attacked isn’t too great. If either of these go off, just invalidate the attack.