Stop UI tweening into corner

When I try and tween my UI size, the size shrinks it into left corner, but I want it’s size to tween into the centre.

					local UIPiecePosition = UIPiece.Position
					
					local UIPieceX = UIPiece.Size.X.Scale
					local UIPieceY = UIPiece.Size.Y.Scale
					
					local NewSize = UDim2.new(UIPieceX/2, 0, UIPieceY/2, 0)
					local OriginalSize = UIPiece.Size
					
					local ButtonPressTween = TweenService:Create(UIPiece, ButtonPressTweenfo, {Size = NewSize})
					local ButtonRiseTween = TweenService:Create(UIPiece, ButtonRiseTweenfo, {Size = OriginalSize})
					
					ButtonPressTween:Play()
					
					ButtonPressTween.Completed:Wait()
					
					ButtonRiseTween:Play()

Make sure the Anchor point on the frame is set to the centre of the frame, ie 0.5,0.5

2 Likes

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