Why is the Y Scale changing when it isn't supposed to?

Note

Everything works except the Y Axis is NOT supposed to move at all.

Achieve

I simply want my tween to move without changing the Y Position at all.

Issue

Well, it’s quite literally in the title. The Y section is moving.

Solutions

I’ve tried recording the position data and using that and it didn’t work and I tried recording the separate data of each position frame and it didn’t work.

Photos

Where it should be:


Where it ends up:

Script

This code is in a localscript

--Made By MillerrIAm
local frame = script.Parent.Parent.Parent.Parent.Parent.GUIs:WaitForChild(script.Parent.LabelName.Value)
---------------------------------------------------------
script.Parent.MouseButton1Click:Connect(function(click)
	if frame.Position == (UDim2.new(-1, frame.Position.Y)) then
		spawn(function()frame:TweenPosition(UDim2.new(0.3, frame.Position.Y), 'In', 'Linear', 0.3) end)
		script.Parent.Indicator.BackgroundColor3 = Color3.fromRGB(0,170,0)
		script.Parent.Text = script.Parent.LabelName.Value..": Open"
	else 
		spawn(function()frame:TweenPosition(UDim2.new(-1, frame.Position.Y), 'In', 'Linear', 0.3) end)
		script.Parent.Indicator.BackgroundColor3 = Color3.fromRGB(170,0,0)
		script.Parent.Text = script.Parent.LabelName.Value..": Closed"
	end
end)

Thank you to anyone who helps.

Could you provide a video or image of what is moving and how it’s moving?

Thanks! :slight_smile:

I just did an edit to show the main issue, go ahead and look at the

Everything else works fine, I just need to fix the Y Axis moving.

Small mistake, it’s:

UDim2.new(0.3, 0, 0, Frame.Position.Y.Offset)

Not:

UDim2.new(0.3, Frame.Position.Y)

It’s because it goes like:

x scale
x offset
y scale
y offset


This applies to the other tween too.


Replying to @xZylters reply below, no you don’t UDim2.new uses both Offset and scale, which is what the Op is using.

1 Like

If you are opposed to using both scale & offset then you can use UDim2.fromScale or UDim2.fromOffset.

Edit: Nevermind, you are using both Scale & Offset

1 Like

This is half true.

For one thing you are seemingly falsely identifying Offset/Scale with your Y value, however you also need to identify .Scale of the Position.Y (otherwise it’s attempting to identify a UDim value as a number value).

Keep in mind a UDim2 value is formatted as (XScale,XOffset,YScale,YOffset).

UDim2.new(0.3,0,Frame.Position.Y.Scale,0)

Try this OP, it should fix your issue.

3 Likes

@xZylter, @TerryMichaelBrunk & @VegetationBush, thank you for helping me with this small issue. I would of never thought of using the fromOffset or fromScale, although they didn’t fix the issue it was still good to know. Thank you again.