What you're asking for is indeed very difficult.
Your thing must be done with one line. ONE. LINE. What i said is just a sample of how frustratingly hard it is to get the distance between parts.
The only thing that makes it easier is that there are two ways to get that distance:
.magnitude
This is a Vector3 property, which obtains the distance between the vector and the origin (0,0,0). Chances are, however, you will not want the origin, but the part's position. This is unfortunately quite hard to obtain: Keep up with me here, the method will be very extensive:
You reduct any two Vector3s and "magnitude" them altogether.
print((workspace.PartA.Position - workspace.PartB.Position).magnitude)
DistanceFromCharacter()
This is a faster, albeit difficult function to use. It is a function that calculates the distance inbetween the player's character's head and the inputted Vector3.
If the player's character does not exist on that time, it returns 0 instead of breaking the script.
print(game.Players.MasterDaniel:DistanceFromCharacter(workspace.Marios2.Head.Position))
Hopefully this helps, if your mind is not melted already by trying to figure out all of this.
(Moral: Don't underestimate any programming language. That's what i did with Brainfuck (the language, literally) and then i saw a clock that tells the time made with it.)
(Note: I am not making the above up.)
(Note #2: I mean no offense on this answer. The sarcasm on how simple it is is there for entertainment.)
*Edited .magnitude as of 12/12/15.
2 comments
I'm not quite sure what you should do. You could possibly make a CanCollide = false Invisible part to represent the range and use touch to see if they're in that spot, but this is a hacky way to go at it.. You probably would need to use Magnitude/DistanceFromCharacter. I would think Region3 would be perfect for your problem, but I have been told otherwise, I do not know how to use Region3 either.
I'll play around with it. I currently use the invisible blocks but they're a bit hacky. Region3 could be promising I guess. I'll take a look.