Bug with tweening gui, can someone help me?

Hi, I’m rip_Zephyr, and after like 20 minutes of watching an episode of a gui tweening tutorial, I’ve finally done it. However, it expands from the top left corner, but I want it to expand from the center in all directions.

The issue:

The code:

local indexButton = script.Parent.Parent.Parent:WaitForChild("buttons"):WaitForChild("indexButton")
local index = indexButton.Parent.Parent:WaitForChild("index")
local playlistFrame = index.Parent.Parent:WaitForChild("playlistGui").Frame

indexButton.MouseButton1Click:Connect(function()
	
	
	if index.Size == UDim2.new(0,0,0,0) then
		index.Visible = true
		playlistFrame.Visible = false
		index:TweenSize(				-- Set tweening properties
			UDim2.new(0.6, 0, 0.65, 0), -- The size we want the index to be when tweening is finished
			"Out", 						-- The easing direction, in this case it's small to big
			"Sine", 					-- Easing style
			0.75,						-- Duration
			false						-- Will it override other tweenings?
		)
	else
		index:TweenSize(				-- Set tweening properties
			UDim2.new(0, 0, 0, 0), 		-- The size we want the index to be when tweening is finished
			"In", 						-- The easing direction, in this case it's small to big
			"Sine", 					-- Easing style
			0.75,						-- Duration
			false						-- Will it override other tweenings?
		)
		index.Visible = false
		playlistFrame.Visible =	true
	end
end)

Does anyone know how I can make the ui expand from the center? If so, please reply down below!

set the frames AnchorPoint to 0.5, 0.5 and the Position to 0.5, 0, 0.5, 0

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.