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

How do I tween this UI's position?

Asked by 4 years ago

Suppose I have a Frame's position is

UDim2.new(0,0,0)

and I want to tween the Frame's position X by 2, how do I do that? I tried the following but it returns an error.

frame:TweenPosition(UDim2.new(frame.Positon.X - 2, frame.Position.Y, frame.Position.Z)

Thanks:)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

This is pretty easy to do when you get the hang of it.

All you need to do is define a frame, textbox, textlabel, etc. (basically any GUI object) and just put: TweenPosition() on the end of it with 4 properties.

Example:

local frame = script.Parent

frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 1)

0.5, 0, 0.5, 0 will basically tween it to the middle of the screen. Assuming, its a frame and you didn't resize it. But you can put any position in there.

For more information, you can go here

0
Oh and the correct thing to do would be to do this: (0, frame.Position.X, 0, frame.Position.Y) namespace25 594 — 4y
0
-2 foreach. namespace25 594 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I want to tween it base on it's original position, for an example, if it'x X is 0, I want it to tween to 0.5, if It's 0.3, I want it to tween to 0.8.

0
Then just add 0.5 User#24403 69 — 4y

Answer this question