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

How would I loop Loop/Repeat?

Asked by 10 years ago
Redlight.Enabled = true
wait(3)
Redlight.Enabled = false
wait(3)

I want it to repeat it self, so it always blinks the redlight. What is the loop code?

4 answers

Log in to vote
2
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago
while wait(3)do
    Redlight.Enabled=not Redlight.Enabled
end

Switches Redlight.Enabled every 3 seconds

Ad
Log in to vote
1
Answered by 10 years ago
while true do
Redlight.Enabled = true
wait(3)
Redlight.Enabled = false
wait(3) -- I added this because you don't want it to loop instantly back to on. Needs some smoothness, y'know?
end
Log in to vote
0
Answered by 10 years ago

1 Redlight.Enabled = true 2 wait(3) 3 Redlight.Enabled = true 4 wait(3)

It will repeat that way.

Log in to vote
-4
Answered by 10 years ago
while true do
-- Whatever
end

Answer this question