Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way I can create a Scale Factor in coding?

If you learned Scale Factors in Algebra then you should be familiar with this term.

But anyways, my idea is to use math like where you have 2 fractions. But you put this into like an 'if' statement.

Like for every 1/5 25 is subtracted from a variable.

Does that make sense?

6 comments

0

It makes no sense because your question is rendered completely differently on everyone else's browser. Please edit your question and preview it to make sure we see what you mean.

0

Tell me if that's any better

0

This doesn't make sense. Do you mind giving a better example... I have never heard of this term.

0

I'll try yeah. haha

0

"for every 1/5 25 is subtracted from a variable" What? Like every 1/5th seconds? Elaborate please.

0

so like for every 1 subtracted from a variable. I'll use 'a', then 5 is subtracted from, say, 'b'. For every 1 subtracted from 'a', there is 5 subtracted from 'b'. Is that any clearer?

1 answer

✓ Accepted answer

I'm having trouble understanding exactly what you want but is it something like this?

local a, b = 100, 100
local aScale, bScale = 1, 5

local function Add(amount)
	a = a + amount*aScale
	b = b + amount*bScale
end

local function Subtract(amount)
	a = a - amount*aScale
	b = b - amount*bScale
end

Using this, if you called Add(2), then

a = 100 + 2 * 1 = 102

b = 100 + 2 * 5 = 110

1 comment

0

Yeah man, you got it. Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.