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

why cant I loop this?

MoneyValue=script.Parent.Parent.MoneyValue.Value

while
MoneyValue=(MoneyValue+1)

end

script.Parent.Text = (MoneyValue)

its trying to add a number value in a certain value and then have its parent witch is a text box have the text of the textbox say the value.

1 answer

✓ Accepted answer

Hey, I don't think you fully understand Lua syntax. Take a loop around to this page, http://wiki.roblox.com/index.php?title=RBX.Lua_Glossary#While_Loop. While loops need a condition and of course the do-end.

Here's what your code should look like.

local money = script.Parent.Parent.MoneyValue

while true do
	money.Value			= money.Value + 1
	script.Parent.Text	= money.Value
	wait() -- if you don't add this, you will crash!
end

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