I want to do the opposite of this. This script right here just makes it so that the ticking sound goes faster the further away someone is from the NPC. I want it to be so that it ticks faster the closer someone is to the NPC.
You might want to subtract the result by 1, because as the number gets larger in this equation (distance increases), the result will increase closer and closer to 1.
You need the reciprocal. Instead of doing /5 at the end, do 5/ at the beginning. This is essentially flipping the fraction.
When magnitude is smaller, if it’s on the bottom of the fraction it will make the resulting number higher (such as 5/0.1 = 50). When magnitude is larger, i.e. you’re further away, then it’ll make the number smaller (such as 5/10 = 0.5).