Math for my scripts

Hey! I am making an equasion game and I wanted to know how would I be able to make it into an equasion. For instance, one thing im stuck on in the script is if I wanted to write 50 divided by 50 then times it by the elevation of something, I would say 50/50xE

But if I was saying I have 2 numbers, 49 and 59, and I wanted to know how much 49 goes into 59 in a percent what would I say? 49%59? What would I do?

Not sure if this is what you want, but couldn’t you just simply divide the 2 numbers then multiply by 100 to get a percentage?

local Number1 = 50
local Number2 = 245

local Percentage = (Number1 / Number2) * 100
print(Percentage) --Would output back as 20.40816327

You can look up some math here: math | Roblox Creator Documentation

Most coding languages do simple things for basic operators.

+ = Addition
- = Subtraction

  • = Multiplication
    / = Division
    ^ = Exponent

When you did 49 % 59, the % is actually the modulus operator. It returns the remainder in division.

Example: 10 / 3. This would equal 3.333333 but 10 % 3 equals 1. 1 is the remainder after dividing 10 by 3. Think of it this way: 3 goes into 10, 3 times equally. But 3 can never fully fit into 10 so normal division had a decimal. So when I said how 3 fits into 10, 3 times, there is a little space left. 3 * 3 = 9. There is a little gap or the remainder. The gap(remainder) is 1. or 10 % 3.