Magnitude Help Value

How can I go about detecting the distance value in magnitude? Like how could I change a value from 0 to 50 depending on the distance of the magnitude? So if your not even in the range its 0 but if your halfway to the origin point it would be 25. How would I do this?

I got a little confused reading your question but I think you want the value to be 50 when you are at a position and 0 when it is 50 studs or more away from the position. Correct me if Iā€™m wrong, but:

You can do value = math.clamp(maxRadius - distance, 0, maxRadius)

maxRadius being 50, or whatever value you want.
distance being (A - B).Magnitude where A and B are vector values.

1 Like

Let me give it a try!

30209202 char limit

How do I set the position which it does the magnitude thing from?

You will probably want it to be

local distance = (char.HumanoidRootPart.Position - game.Workspace.Destination).Magnitude
1 Like