Tween is not tweening centered

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve by hovering a button that this hovered button sizes out centered
  2. What is the issue? Include screenshots / videos if possible!
    the issue is that when i hover a button it doesnt sizes out CENTERED:
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Devforum, and I found out that you can user something called AnchorPoint, no clue tho how to use it

Here is the local script (which works fine):

for i,v in pairs(GameGUI:GetChildren()) do
	if v:IsA("ImageButton") then
		local PreviousSize = v.Size
		local TweenSize = v.Size + UDim2.new(Increase,Increase,Increase)
		local EnterTween = TweenServivce:Create(v,info,{Size = TweenSize})
		local LeaveTween = TweenServivce:Create(v,info,{Size = PreviousSize})
		v.MouseEnter:Connect(function()
			LeaveTween:Destroy()
			EnterTween:Play()
			v.MouseLeave:Connect(function()
				EnterTween:Destroy()
				LeaveTween:Play()
			end)
		end)
		v.MouseButton1Click:Connect(function()
			LeaveTween:Play()
			wait(0.1)
			EnterTween:Play()
		end)
	end
end

any help appreciated!

1 Like

I would probably set the Anchor point in that GUI to 0.5, 0.5 (makes it so that the position property in that GUI is located in the center of the GUI instead of the top left. If that doesn’t work, then you might have to add a Positional tween as well.

1 Like

wow thats insane… IT WORKED. The only problem is that now the guis position got moved a bit to the top left. is there a way to fix this?
EDIT: could i possibly just move the buttons back to their position?

2 Likes

Just move the buttons to their previous position.

1 Like