# How can I tell how much has been decreased from this formula?

I have a script that decreases a number by percentage but is there a way to tell how much exactly number been decreased? I know the formula of how to tell how much a number has been decreased by percentage but i can’t really use it in lua since it gives off a very low number.

``````local t = __TIX.Value
local d = math.floor(GameEngine:RemovePercent(__TIX.Value, 0.20, "+"))
print(d / t * 100)
-- function
return __TIX.Value + __TIX.Value * -0.20
``````
1 Like

`dNumber = newNumber - oldNumber`

where `dNumber` is how the number changed (so negative for a decrease and positive for an increase).

1 Like

I did do that and it gave a negative value.

``````print(d - t)
``````

What i’m trying to do is check how much the value has been gone down exactly just like how percentage work irl. Where we divide the decreased number by the original number and then multiple the given result by 100, but i can’t use that formula in lua.

Its because the first value is smaller than the second (I think)

``````local dNumber = NewNumber - OldNumber

local PositiveDifferance = math.abs(dNumber)
``````
1 Like

Its negative because there was a decrease in value. You can just subtract the new number from the old number and it will be positive.

Sorry, I’ve no idea what this means. Can you post some example numbers and show what calculation you mean, like what you expected the results to be for some given numbers?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.