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

Very simple addition problem not working?

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

2 comments

0

Be specific. What is the problem exactly?

0

It simply isn't adding to it.

1 answer

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...

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