Why does the light green frame shake?

изображение_2024-12-07_201812262

help please

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local TweenService = game:GetService("TweenService")
local Style1 = TweenInfo.new(5,Enum.EasingStyle.Linear) 

local Button = script.Parent
local UpgradesMenu  = Button.Parent.Parent.UpgradeMenu
local GUI = Button.Parent
local Menu = UpgradesMenu.UpgradesMenu.Menu

local Diagonal = math.sqrt(math.pow(UpgradesMenu.AbsoluteSize.X,2)+math.pow(UpgradesMenu.AbsoluteSize.Y,2))

UpgradesMenu.Enabled = false

Button.MouseButton1Click:Connect(function()
	
	UpgradesMenu.UpgradesMenu.UICorner.CornerRadius = UDim.new(1,0)
	UpgradesMenu.UpgradesMenu.Position = Button.Position
	UpgradesMenu.UpgradesMenu.Size = UDim2.new(0,0,0,0)

	Menu.AnchorPoint  = Vector2.new(Button.Position.X.Scale,Button.Position.Y.Scale)
	Menu.Position = UDim2.new(0.5,0,0.5,0)
	Menu.Size = UDim2.new(0,UpgradesMenu.AbsoluteSize.X,0,UpgradesMenu.AbsoluteSize.Y)
	
	UpgradesMenu.Enabled = true
	
	TweenService:Create(UpgradesMenu.UpgradesMenu,Style1,{
		Size = UDim2.new(0,Diagonal*2,0,Diagonal*2)
	}):Play()
	
end)
1 Like

Is the script named UpgradeMenuOpen and is the green button the Upgrade Button?

It could possibly be because since the UpgradesMenu is expanding, the button has some sort of recentering enabled so it can stay centered which is causing the shaking.