Get the Sword Wielder HumanoidRootPart Position or Sword Handle Position when damage is applied, as well as the part touched by the sword (aka enemy) position
humanoid.Health -= damage
local WielderPos = player.Character.HumanoidRootPart.Position
local targetPos = touchedPart.Position
To get the distance between those positions, use magnitude:
local distance = (WielderPos-targetPos).magnitude
If you want to round the distance, use math.round(distance).
distance = math.round(distance)
If you want to round it with a decimal, then instead of just using rounding do math.round with distance*10, then divide it by 10 afterwards:
distance = math.round(distance*10)/10
To check if distance is larger than 12, use an if statement: