So, I was making a ratio system and tried to compare the values. This unfortunately didn’t work and did the opposite. Here’s the code(not the full code):
if integer1.Value > integer2.Value then
table.insert(results, integer1.Value/integer2.Value)
else
table.insert(results, integer2.Value/integer1.Value)
end
It instead divides integer1 by integer2. I tried this but it had the same results:
if integer1.Value < integer2.Value then
table.insert(results, integer1.Value/integer2.Value)
else
table.insert(results, integer2.Value/integer1.Value)
end
I know this because I made it print the results. Here were the results:
0.44444444444444
Integer1’s value is 4 and Integer2’s value is 9. 9 divided by 4 is 2.25 not 0.44444444444444. I even checked and the calculator had the same answer:
Here’s the function call script, by the way my script is a module script:
local Math = require(script.Parent.MathModule)
local value1 = script.Value1
local value2 = script.Value2
local results = {}
Math.Ratio(value1, value2, results)
print(results[1])
Also, you don’t need the full code, that code are the only lines of code that edit or compare the values.
local integer1=workspace.int1 -- 4
local integer2=workspace.int2 -- 9
if integer1.Value > integer2.Value then
print("1: "..integer1.Value/integer2.Value)
else
print("2: "..integer2.Value/integer1.Value)
end
-- Output= 2: 2.25 - Server - Script:8
I know, I just instanced them for testing.
My point was the code you have provided works as it should so it must be another part of the script causing you issues.
Uhmmm… When I restarted my pc the code worked I guess? Here’s the code:
if integer1.Value < integer2.Value then
table.insert(results, integer2.Value/integer1.Value)
else
table.insert(results, integer1.Value/integer2.Value)
end
end