Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a cash multiplier?

Asked by
hot_spi 20
3 years ago

im trying to make those types of "2x Cash" types of multipliers, but i dont know how. Can someone tell me how? Or maybe or even explain how?

1
Cash = Cash * 2 ? rexhawk 222 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Math in Lua

You will often need to do math operations while programming in Lua. Learn how!

-- Basic Operations

print(2 + 2) -- 4, + is the adding operation
print(2 - 2) -- 0, - is the subtracting operation
print(2 / 2) -- 0, / is the dividing operation
print(2 * 2) -- 4, * is the multiplying operation

-- More Operations

print(2 ^ 4) -- 16, ^ is the; "power of", method / operation, and alternative is math.pow
print(math.sqrt(81)) -- 9, math.squrt(x), is the square root method
print(2 % 2) -- 0, % returns the remainder of the numbers given, also known as math.fmod

-- Math

-- This library is an interface to the standard C math library, providing all of its functions inside the math table.

print(math.pi) -- 3.14, returns the pi number.
print(math.huge) -- math.huge is infinite but in lua, this can be used to make a player immortal
print(math.rad(90)) -- will return the number in degree's
print(math.deg(90)) -- does the opposite of the rad function
print(math.pow(2, 8)) -- 256, will do the same as the ^ operation
print(math.floor(2.123912821491241)) -- will round the number
print(math.ceil(3.6)) -- will round the number up
print(math.fmod(12.1, 224.1233)) -- will do the same as the % operation
print(math.random(2, 5)) -- will return a random number between the two integers
print(math.sin(5)) -- trigonometry, you'll probably learn it in highschool
print(math.cos(5)) -- trigonometry, you'll probably learn it in highschool
print(math.tan(10)) -- trigonometry, you'll probably learn it in highschool
print(math.randomseed(tick())) -- will return a pseudo generated number
print(math.min(2, 3, 4, 6, 123, 1, -34)) -- will return the smallest number in this table; (-34)
print(math.max(2, 4, 123, 12312, math.huge)) -- will return the highest number in this table; (inf / math.huge)
print(math.atan2()) -- a bit too complicated to explain
print(math.atan()) -- a bit too complicated to explain
print(math.acos()) -- too complicated to explain
print(math.log10()) -- a bit too complicated to explain
print(math.log()) -- a bit too complicated;

-- And many more, but i'm not bothered writing too many. You can study more yourself



Answering Your Question

function NewValue()
       local PlayerCoins = amount of coins you have

       return (PlayerCoins * 2)
end)

local NewCoins = NewValue()

print(NewCoins)
Ad

Answer this question