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

[MATH] How can I find a reciprocal on Lua?

Heads Up: Reciprocal is a mathematical term. The best way to explain it is a flipped fraction. E.G: The reciprocal of a fifth is 5.

Based on that definition above, I want to find the reciprocal of any number between 0 and 1 which I will then use to set the transparency of a GUI.

Is there a built-in function or do I need to create some equation?

2 comments

0

What on earth are you actually trying to do? The reciprocal has nothing to do with it. http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem  

0

Edit your question to include example input and expected output.

1 answer

The same way that you find the reciprocal outside of Lua. 1/x is the reciprocal of x, as is x^-1.

Either way, you really don't want to find the reciprocal of a fractional value for the transparency, because the transparency is already a fractional part.

2 comments

0

The thing is that when x = 0, I want the transparency to be 1

1

You mean, you want to do Transparency = 1-x

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