Pause localscript execution until TweenPosition completes?


I’d like to have a loop, for an information screen, using a screengui.
It’d be useful if the script paused automatically before continueing with the next tween. I think believe to remember that it was like that in the past, but I’m not sure.

print("Done with first!")

Thanks in advance! :slight_smile:



Maybe this is what you’re looking for?


Lol,I know I can use that, but I remember that like a month ago, I managed to just use 1 line of code.
Thanks for trying, though!

This would it be if it’s like what I mean:



Alright. I don’t recall TweenPosition ever being able to yield, but maybe I’m wrong.

Edit: I am probably very wrong but :Wait() ?


Alright, is there a thing like:



The best way to do it is as @Voidage stated.

If you really don’t want to do that, I suggest you look into TweenService. The Tween object has a “Completed” event.


I don’t think so. Maybe you could look for your old code and see if you can find what you did? I still think a wait is the only way. I’ve never seen anyone else do it another way.


Alright, thanks!

Alrighty! It’s still early in the morning for me, so I’m most likely still sleeping, lol.

Thanks for the help! :slight_smile:


The 6th argument of TweenPosition is a function that runs when the tween is completed. You shouldn’t use it though as it is bad practice.

Gui:TweenPosition(Position,“Out”,“Quad”’,1,true,function() print’tween over’ end)




The Tween members on UI objects shouldn’t be used because they have strange limitations and TweenService can do everything that these methods can and more. The tween methods on UI will probably be deprecated at some point. Use TweenService instead. You can wait for the tween to complete like so:

local tween = TweenService:Create(Gui,, {Position = ...})

-- OPTION 1:
local state = tween.Completed:Wait()
-- do action after tween

-- OPTION 2:
    -- do action after tween