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

Adding value script?

Asked by 8 years ago

Like in a number value, how would you add numbers and subtract them? I tried this but It doesn't work:

local v = workspace.value
v.value + 1

So how do you add value?

1 answer

Log in to vote
2
Answered by
4Bros 550 Moderation Voter
8 years ago

NumberValues have a .Value property. In order to add to them you need to do it like this:

local numberval = game:GetService'Workspace'.Value -- The numbervalue
numberval.Value = numberval.Value + 1  -- Adding to the value of the numbervalue

-- In order to add to any value, you need to make their value equal to their last value plus the new value Ex: local derp = 0 derp = derp + 1 
Ad

Answer this question