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

How do you make sure your thread yields during a function?

Mostly for builtin functions such as tweening orbwith camera manipulation methods that involve a duration time.

3 comments

1

You could make a custom function that does the function you want to do and then add a wait with the amount of time you pass in your tweening function and then just call that function in your code.

0

Or, alternatively, just wait() for the amount of time the non-yielding function is supposed to last.

0

You could do that, but if you have a lot of tweens, making a function reduces the amount of lines you have to write.

1 answer

✓ Accepted answer

The simplest method is to just wait() the amount of time you set for the Tween or camera interpolation:

gui:TweenPosition(UDim2.new(), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 4, true)
wait(4)
--fully tweened

2 comments

0

Ah kk, wasn't sure that'd be precise enough.

0

It's close enough if the wait is longer than about .1 seconds.

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