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

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

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

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!

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