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

How do I tween only the Y value of a frames Position?

Asked by 1 year ago

I have a frame and a button, when clicking the button, I wanted it to move the frame up ever-so-slightly (maybe an inch in physical terms).

But the difference I have is that I don't wanna tween it to an exact position, for example if I would usually do this for a part, I'd do this:

local PartTween = Part:TweenPosition(Part.Position + Vector3.new(0, 0.10, 0)

Something like the above worked to just move the part +0.10 Y Axis, now doing this for UI (a frame I have), simply isn't the case

Let me show you what I tried

Frame:TweenPosition(UDim2.new(Frame.Position.Y.Scale + 0.03), "Out", "Bounce")

The original position of the frame was {0.409, 0},{0.499, 0}, and after tweening it so it can move to {0.409, 0},{0.502, 0}, it instead moved to {0.409, 0},{0.0, 0}.

Is there any way you can help me? I've found no explanation of it anywhere

1 answer

Log in to vote
2
Answered by 1 year ago

To answer my own question as I figured it out:

Frame:TweenPosition(UDim2.new(Frame.Position.X.Scale, Frame.Position.X.Offset, ((Frame.Position.Y.Scale + -0.07)), Frame.Position.Y.Offset), "Out", "Bounce")

Now without setting a specific position (like 0, 523, 0, 042, 0 or something), it will go up 0.07!

Ad

Answer this question