How would I make a system that decreases a number based on how far it is away from a part?

Alright so basically, There’s the basepart, Position: Vector3.new(0, 0, 0)

I’m trying to get the distance of my character from said part. But instead of an increasing number (based on distance: 50 studs away, 60 studs.) I don’t know how to decrease it. So that the farther you are away from the basepart the number gets smaller. So basically at 0, 0, 0 you start with a max value at 1000, Then as you walk away, It goes down, 1000, 900, 800 etc until you hit 0.

I’ve tried using math.clamp and inverting numbers, but to no avail. Does anyone have a solution? This is for an earthquake simulation I’m trying to make. The effect of the earthquake is stronger as you get closer to the area of effect.

Use this formula:
1000 - Distance from center = earthquake strength
Probably want to clamp it also.

2 Likes

Thank you much. I appreciate you.

1 Like