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

why cant I loop this?

Asked by 8 years ago
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

Log in to vote
0
Answered by 8 years ago

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
Ad

Answer this question