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

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

Asked by 7 years ago

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

Closed as Not Constructive by Goulstem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
3
Answered by
jotslo 273 Moderation Voter
7 years ago
Edited 7 years ago

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.

0
To note, lua also works with Order of Operations, so you don't have to have too much worry. :P TheeDeathCaster 2368 — 7y
Ad