Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a script to Add and Subtract?!

Can you please tell me and explain an adding and subtracting script!

1 answer

✓ Accepted answer

Addition and Subtraction in RBX.Lua is simple.

To add two numbers together, you can do the following which returns 10 5 + 5

To subtract a number from another, you can do the following which returns 2 7 - 5

You can set a variable to the result like this local varname = 7 - 5

and you can output the result like this print(varname)

Additionally, you can add two variables together like this. In this example, 15 will be printed because 10 + 5 = 15

local var1 = 10
local var2 = 5
print(var1 + var2)

I highly recommend you take a look at the Intro to Scripting on the Roblox Wiki here.

1 comment

0

To note, lua also works with Order of Operations, so you don't have to have too much worry. :P

This discussion is preserved as it was. New answers, comments, and votes are closed.