TweenPosition (Method)
From Legacy Roblox Wiki
Jump to navigationJump to search
TweenPosition( UDim2 endPosition, Enum easingDirection = Out, Enum easingStyle = Quad, float time = 1, bool override = false, function callback = nil ) | |
Returns | nil |
Description: | Smoothly moves a GUI to a new UDim2 position. |
Member of: | GuiObject |
The endPosition, is where the GUI moves to. For example if the GUI is at UDim2.new(0, 0, 0, 0) and you want it to move to UDim2.new(1, 0, 1, 0) it would be
GUI:TweenPosition(UDim2.new(1, 0, 1, 0))
The easingDirection, can be either. In, Out, or InOut. Most commonly it is Out.
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out")
The easingStyle could be 8 different items.
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad")
The float is how long it will take it to move. 1 is the default. Let's make it take 3 seconds.
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
The override will allow you to start another tween while the first one is in progress. In order for this to happen, we have to set booloverride to true.
GUI:TweenPosition(UDim2.new(1, 0, 0, 0), "Out", "Quad", 3, true) wait(1.5) GUI:TweenPosition(UDim2.new(0.5, 0, 1, 0), "Out", "Quad", 3, false)
So in the above example it will Start tweening to the right side of the screen, but half way through it will start another tween and make it go to the bottom.