How can I fix this tween error?

I’m trying to tween these guis but it gives me this error when I run it, “attempt to call a UDim2 value” on line 9 which is on the position value. How do I fix this?

local frame = script.Parent.Parent.Frame
local frame2 = script.Parent.Parent.Frame2
local buttons = game.StarterGui.ShopGui.Buttons
local button = script.Parent.Parent.ImageButton
local button2 = script.Parent
script.Parent.MouseButton1Click:Connect(function()
	buttons:TweenSizeAndPosition(
		UDim2.new(0.12, 0,0.36, 0),
		UDim2.new(-0.137, 0,0.4, 0)
		"Out",
		"Quad",
		.5,
		false

	)

	frame:TweenSizeAndPosition(
		UDim2.new(0, 158,0, 248),
		UDim2.new(-0.116, 0,0.285, 0),
		"Out",
		"Quad",
		.5,
		false

	)

	frame2:TweenSizeAndPosition(
		UDim2.new(-0.11, 0,0.297, 0),
		UDim2.new(0, 141,0, 227),
		"Out",
		"Quad",
		.5,
		false

	)

	button2:TweenSizeAndPosition(
		UDim2.new(0, 32,0, 28),
		UDim2.new(-0.001, 0,0.453, 0),
		"Out",
		"Quad",
		.5,
		false

	)
	button.Rotation = -90
end)

Your missing a comma

UDim2.new(-0.137, 0,0.4, 0)--(HERE)
"Out",

Solution

UDim2.new(-0.137, 0,0.4, 0),
"Out",

Wow, I can’t believe I missed that. Thanks for the help.

1 Like
UDim2.fromScale(-0.137, 0.4)

You can also just do this if you’re only setting the scale (still need the comma).

and similarly for the times you’ve only set the offset.

UDim2.fromOffset(32, 28)