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

How do I fix this loop?

Asked by 9 years ago

Brick = game.Workspace.Part

while true do Brick.BrickColor = BrickColor.Red() wait(5) Brick.BrickColor = BrickColor.Gray() end

What I want it to do is to Make the brick red, then gray, then red, then gray, etc. Im not sure if im using the correct type of loop. Is my first time using a loop and I don't really understand the difference between the 3 types.

0
I have answered a Question about 'How to do loops' here: https://scriptinghelpers.org/questions/5892/how-to-do-loops#7836 TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Must have been syntax errors

local brick = game.Workspace.Part

while true do
    brick.BrickColor = BrickColor.Red();
    wait(5)
    brick.BrickColor = BrickColor.Gray()
    wait(5)
end

http://wiki.roblox.com/index.php?title=Loops

0
Woah man you really helping me out MatiasSicarius 45 — 9y
0
One more question, how do I stop a loop? And resume it later if possible MatiasSicarius 45 — 9y
0
A 'break' statement stops a loop Tkdriverx 514 — 9y
Ad

Answer this question