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

How do I add a number values value by 1?

Asked by 4 years ago

So, I am a intermediate builder and a pro scripter. I am trying to figure out how to add number values by 1. Something like this:

script.Parent.NumberValue.Value += 1

But then up comes an error from output, I don't know what I've done wrong. Can somebody please help?

0
Could you show more of the code? Also , what is the error? RebornedSnoop 175 — 4y
1
@RebornedSnoop Already answered. diorlandripp 4 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Augmented assignment isn't really a thing in Lua. You have to actually write it out in full:

script.Parent.NumberValue.Value = script.Parent.NumberValue.Value + 1

Lua is weird.

1
Thanks dude! diorlandripp 4 — 4y
Ad

Answer this question