UI tween script bugging

How do I fix the buttons staying big when i hover over it fast? https://gyazo.com/f6799e488444e30df07d594a46cfa03d

local ShopButton = script.Parent.Buttons.ShopButton
local DanceButton = script.Parent.Buttons.DanceButton
local MusicButton = script.Parent.Buttons.MusicButton
local SettingsButton = script.Parent.Buttons.SettingsButton
local CodesButton = script.Parent.Buttons.CodesButton

local ShopFrame = script.Parent.Shop
local DanceFrame = script.Parent.Dances
local MusicFrame = script.Parent.Music
local SettingsFrame = script.Parent.Settings
local CodesFrame = script.Parent.Codes

local Click = script.Parent.Click

ShopButton.MouseEnter:Connect(function()
	ShopButton:TweenSize(UDim2.new(0.799, 0,0.168, 0),"In", "Linear", .1)
end)

DanceButton.MouseEnter:Connect(function()
	DanceButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
end)

MusicButton.MouseEnter:Connect(function()
	MusicButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
end)

SettingsButton.MouseEnter:Connect(function()
	SettingsButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
end)

CodesButton.MouseEnter:Connect(function()
	CodesButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
end)




ShopButton.MouseLeave:Connect(function()
	ShopButton:TweenSize(UDim2.new(0.706, 0,0.162, 0),"In", "Linear", .1)
end)

DanceButton.MouseLeave:Connect(function()
	DanceButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

MusicButton.MouseLeave:Connect(function()
	MusicButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

SettingsButton.MouseLeave:Connect(function()
	SettingsButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

CodesButton.MouseLeave:Connect(function()
	CodesButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

Try adding a debounce to the Events.

I thought of that but I wasnt sure on how to add it, I suck at scripting. Could you help me out by writing one of the codes out?

im back on my pc and i rewrite the code, try changing your old code to this

local ShopButton = script.Parent.Buttons.ShopButton
local DanceButton = script.Parent.Buttons.DanceButton
local MusicButton = script.Parent.Buttons.MusicButton
local SettingsButton = script.Parent.Buttons.SettingsButton
local CodesButton = script.Parent.Buttons.CodesButton

local ShopFrame = script.Parent.Shop
local DanceFrame = script.Parent.Dances
local MusicFrame = script.Parent.Music
local SettingsFrame = script.Parent.Settings
local CodesFrame = script.Parent.Codes

local Click = script.Parent.Click

local hover_shop = false
local hover_dance = false
local hover_music = false
local hover_code = false

ShopButton.MouseEnter:Connect(function()
        hover_shop = true
        if hover_shop == true then
              	ShopButton:TweenSize(UDim2.new(0.799, 0,0.168, 0),"In", "Linear", .1)
        end
end)

DanceButton.MouseEnter:Connect(function()
        hover_dance = true
        if hover_dance == true then
               	DanceButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
         end
end)

MusicButton.MouseEnter:Connect(function()
        hover_music = true
        if hover_music == true then
             	MusicButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
       end
end)

SettingsButton.MouseEnter:Connect(function()
        hover_settings = true
        if hover_settings == true then
             	SettingsButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
       end
end)

CodesButton.MouseEnter:Connect(function()
         hover_code = true
        if hover_code == true then
             	CodesButton:TweenSize(UDim2.new(0.706, 0,0.16, 0),"In", "Linear", .1)
       end
end)




ShopButton.MouseLeave:Connect(function()
        hover_shop = false
       if hover_shop == false then
             	ShopButton:TweenSize(UDim2.new(0.706, 0,0.162, 0),"In", "Linear", .1)
       end
end)

DanceButton.MouseLeave:Connect(function()
        hover_dance = false
       if hover_dance == false then
       	DanceButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
       end
end)

MusicButton.MouseLeave:Connect(function()
        hover_music = false
       if hover_music == false then

	MusicButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

SettingsButton.MouseLeave:Connect(function()
       hover_settings = false
       if hover_settings == false then
             	SettingsButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
       end
end)

CodesButton.MouseLeave:Connect(function()
	CodesButton:TweenSize(UDim2.new(0.666, 0,0.152, 0),"In", "Linear", .1)
end)

Still doesnt work, they are still big.

I assume that these just scale a UI bigger when the mouse is entered so here’s my suggestion:

Add UIScale into each of the buttons, then just use normal TweenService and set the scale property to 1.2 for example, and do the same for the mouse leave but to 1 instead. This is what I personally use as it causes less issues.