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

Adding a number to a current value?

I'm trying to make it so I add +50 to a values current numbers instead of changing the value to 50

game.Workspace.Group.Value = 50

that just makes the value go to 50 not add 50 to the current value

3 answers

You need to make mathimatical things like this:

game.Workspace.Group.Value = game.Workspace.Group.Value + 50

#What you could do Use Arithmetic Operators to add 50 to the value


#Examples of Arithmetic Operators? ####Addition

print(50+50) --100

####Subtraction

print(50-50) --0

####Multiplication

print(50*50) --2500

####Division

print(50/50) --1

####Unary Negation Finds the opposite of a number

print(-50) --prints the opposite of 50; -50

####Exponentiation The power of something

print(50^2) --prints 50²; 2500

####Modulus Written as a%b, it will divide a with b and return the remainder

print(50%3) --2 because 50/3 is is 16 with a remainder of 2.

#Final Product

game.Workspace.Group.Value = game.Workspace.Group.Value+50 --Adds the group value with 50 assuming group value is an integer.


Hope it helps!

Really? Thought the wikia had this! oh well do this

game.Workspace.Group.Value = +50

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