I’m just curious, but how would I be able to calculate points in math, without them actually being there?
What I’m talking about, is, let’s take this example.
local num = 0
local magnitude
while wait() do
magnitude = (workspace.Wedge.Position - workspace.Part.Position).magnitude
if magnitude =< 20 then
num = 10
end
if magnitude >= 100 then
num = 100
end
end
With the above code, you can see that num is 10 when magnitude is or is less than 20, and num is 100 when magnitude is or is greater than 100.
Now what I want to know is how can I calculate what num would be when magnitude is, let’s say, 60, without actually setting what it would be at that value in the script.
Thanks in advance (if you answer).
By the way, I’m sort of not curious, because I want a damage range system in my guns, so that’s basically it.
So I completely misread the question in my first response, so what you’d actually want to do is what is called a peacewise function where there are multiple parts.
You’re peacewise would look something like this
local function DamageRange(Range)
if Range <= 20 then
return 10;
elseif Range >= 100 then
return 100;
else
return 1.125 * Range + -12.5
end
end
I’m sorry if I’m asking too much but would 1.125 and -12.5 change depending on the value set by Range, and if so, what mathematical equation would I compute to set the right value?