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

Very simple addition problem not working?

Asked by
unmiss 337 Moderation Voter
9 years ago

Variables:

local MPM = script.Parent.MPMValue -- number value
local CM = script.Parent.CMValue -- number value
local CMText = script.Parent.CurrentMoney

Code:

while wait(5) do
    CM.Value = (CM.Value + MPM.Value)
end
0
Be specific. What is the problem exactly? Spongocardo 1991 — 9y
0
It simply isn't adding to it. unmiss 337 — 9y

1 answer

Log in to vote
0
Answered by
davness 376 Moderation Voter
9 years ago

There are not problems on your script. You just cannot see the value property change directly on the Value instance. To get the new value, use the output. Once you have number values and you need a string one to call print, you should call tostring function over print.

local MPM = script.Parent.MPMValue -- number value
local CM = script.Parent.CMValue -- number value

print(tostring(CM.Value)) -- prints the initial value

while wait(5) do
    CM.Value = (CM.Value + MPM.Value)
    print(tostring(CM.Value)) -- prints the new value
end

Now see...

Ad

Answer this question