#Can I make loops that stop when something happens?

26 messages · Page 1 of 1 (latest)

rose owl
#

Is it possible?

wind ridge
rose owl
#

How can I make them

rustic jasper
#

Depends on what you want to happen.

#

A property of an object to change?

#

:GetPropertyChangedSignal()

#

Else something like this works:
for i=1, 10, 1 do
if i==4 then break;
end

#

There are many ways to stop a loop.

west patrol
#

Wait isn’t it like

    —whatever
end
rustic jasper
#

That's also another way of doing it.

west patrol
#

I’m not really good with scripting either so don’t take my words seriously lol

patent yew
# rose owl How can I make them
local touched = false 
script.Parent.Touched:Once(function()
    touched = true
end)

repeat
     task.wait(1)
     print("Hello World!")
until touched
west patrol
#

Trust the pros

west patrol
#

:D

proven charm
proven charm
#

it will also stop once the index reaches 10

late parrot
#

the variable will become true after 15 seconds

#

when it becomes true this loop will stop

#

also specify which loop do u want?

#

for loop? while loop?

west patrol