Very simple math issue

So I want to update the price of something based on DataStore when player joins.

I do

powerGUI.Price.Value*(3^power.Value)

where Price.Value is always 100, and power.Value is a DataStore value, in this instance 3.

What I think 3^3 does is

3*3*3

--so if I do 3^5 It will do
3*3*3*3*3

But it seems like I use the wrong operator, because instead of 2700 ( 100*(3^3) ), it gives me 24300 something

What operator should I use to get the “degree” (I dont remember if thats what its called) of a number

The operators are correct, and the order of operations should be fine, even without the parentheses. Have you tried printing powerGUI.Price.Value and power.Value?

1 Like

Price.Value is always 100. Power.Value in this case is 3. I didn’t check power value, it may have been 4, but in that case it should ve given 81000, not a weird 24300. But I will check them again

powerGUI.Price.Value*(3^power.Value)

The reason you got 24300 is because power.Value is equal to 5 in the equation.

100 * (3^5) = 24300

If power.Value is 3 then it would result in

100 * (3^3) = 2700
2 Likes

I forgot that I was updating price value in a more simple way in another part of the script, so it wasn’t always 100. Thanks for the replies