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

is there a inverse function or anything to a int value if not how to make inverse?

For example if a int value is -100 and it touched a part it should turn into positive +100 is there any inverse value in this.?

5 comments

1

yea, multiply the number by -1

0

No inverse function?

0

You can easily make your own function using theking's idea

0

There is a simple way to do this. Use the math.abs function. http://lua-users.org/wiki/MathLibraryTutorial

0

If you're using an IntValue, the code would look something like this: iValue.Value = math.abs(iValue.Value). If however, you want the opposite of whether the number is positive or negative, just multiply by -1 as theking said.

1 answer

No but you can implement your own function.

local function IV(v)
    if type(v) == "number" then
        return v*-1
    end
end

local num = -2
local num = IV(num)
print(num) -- It pritns 2

1 comment

0

Please use proper indentation in your answers.

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