Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to run a portion of code without yielding the script?

Basically what I mean by this is something like this

local function test()
	print('abc')
	wait(1)
end

test()
print('this printed one second after abc assuming server didnt wait longer')

What I want to do is make that second print() occur right after abc is printed while still having the wait in the function

1 answer

✓ Accepted answer

You cannot remove a yield from a script but you can use spawn or even delay

More infomation can be found on the threading wiki page.

Example:-

local function test()
    print('abc')
    wait(1)
	print('test end')
end

spawn(test)
print('this printed one second after abc assuming server didnt wait longer')

I hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.