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

How would I make 2 lines run at once in a script?

Asked by
Scriptecx 124
9 years ago

How would I make 2 lines run at once in a script?

0
Not sure if this is possible, 1st, why would you need to do this? 2nd, using no waits make it un-noticeably fast doing what your code directs. alphawolvess 1784 — 9y
0
Is there something in particular you're trying to accomplish by running 2 lines at once? funyun 958 — 9y
0
No, I was just wondering if it was possible. Scriptecx 124 — 9y

1 answer

Log in to vote
1
Answered by
funyun 958 Moderation Voter
9 years ago

Look up coroutines. I don't know about single lines, but you can run several bits of code at the same time in the same script this way.

coroutine.resume(coroutine.create(

function()
    while wait() do
        print("hey")
    end
end

))

coroutine.resume(coroutine.create(

function()
    while wait() do
        print("hi")
    end
end

))

while wait() do
    print("what's up")
end
0
Interesting, I will look that up. Scriptecx 124 — 9y
Ad

Answer this question