Help with tweening gui

Hello, I am learning how to tween GUIs using this article.
Here is a screenshot of where it is

This is my script.

local frame = script.Parent.Parent.Frame

script.Parent.MouseButton1Click:Connect(function()
	frame.AnchorPoint = Vector2.new(0.5, 0.5) --change these both on the item
	frame.Position = UDim2.new(-0.4, 0,0.5, 0)

	wait(2)

	frame:TweenPosition(UDim2.new(0.308, 0,0.185, 0)) --desired end location
end)

Any help is appreciated.

1 Like

The script isn’t wrong. It’s a common issue with the studio screen size. You can go on the test tab then devices and choose your device so it correctly scales it. There are some plugins to automatically do it. [Plugin] AutoScale Lite for GUIs - Scale your UI

what exactly is wrong? I just see your code and an image

Are you saying I should use Unconstraint’s? I already set all of my GUIs to scale.

The gui when you click the button goes to the top of the screen and I want it in the center. I didn’t know if it was the script or something else so I added the script.

the gui object needs to be centered to begin with. ( i believe position of the y axis needs to be .5 of scale )

ripepperoni’s/zawie’s gui tools can help, unfortunately idk the plug in link.

found it:

I changed the y-axis to .5 and it seemed to make it work now. I will check out the plugin, thank you.