Categories > Exploiting > Scripts >

[REQ] run a loop within a script without it getting interrupted

Posts: 253

Threads: 44

Joined: Oct, 2020

Reputation: 7

Posted

print("A")

while wait() do

-- idk something here

end

print("B")

 

basically what im trying to do is to make it print "A", run an infinite loop, and print "B"

any ways i can do this? (please dont just put print("B") in front of the loop i need a real solution) 

  • 0

soy pro

mrk0

mark

Posts: 62

Threads: 3

Joined: May, 2022

Reputation: 2

Replied

If I understood the question right, what you might be looking for is coroutines: https://create.roblox.com/docs/reference/engine/libraries/coroutine

  • 0

https://media.discordapp.net/attachments/995070188628221952/1022545309529808996/mrk0banner5.png

Posts: 1227

Threads: 68

Joined: May, 2022

Reputation: 17

Replied

basically what mrk0 said

coroutine.wrap(function()
    while true do
        -- ur looping code here
        task.wait()
    end
end)()

  • 0

Did I mention I use arch btw?

Posts: 27

Threads: 0

Joined: Oct, 2022

Reputation: -21

Replied

Wow
It's very cool.

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )