I’m currently working on a horror game which will have a spirit box like item inside (similar to Phasmophobia). I have got the distance between 2 parts using .Magnitude already but the further away the part is, the bigger the value.
I don’t want this to be the case as I want the value to increase as the parts get closer.
For clarification, my suggestion would be a rational function, whereas the suggestion made by @Jxl_s is linear. Just keep those in mind when deciding which is best for your need.
The actual mathematical answer to this post is currentMagnitude^-1, because you’re asking for its inversion.
The inverse of currentMagnitude is currentMagnitude^-1 (remember to check if currentMagnitude is zero!), you can then multiply it by a factor if you believe it’s too low.