TweenSize not tweening when MouseLeave too fast

Basically what I want to do is to make the button tween when the mouse leaves the button (not hovering the button) but it doesn’t seem to work as shown here:


It does work if you wait for 1 second

Just to make it clear, this is an example of what I’m trying to make

Here’s the script tho

settingsButton.MouseEnter:Connect(function()
	print("tweened 1")
	settingsButton.Frame:TweenSize(UDim2.new(0, 300, 0, 40), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
end)

settingsButton.MouseLeave:Connect(function()
	print("tweened 2")
	settingsButton.Frame:TweenSize(UDim2.new(0, 3, 0, 40), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.6)
end)

(this is my first time making a topic so idk how this works)

There is an option when using TweenSize to allow the tween to override any tween already playing so you just need to set this to true on your tweens:

settingsButton.MouseEnter:Connect(function()
	print("tweened 1")
	settingsButton.Frame:TweenSize(UDim2.new(0, 300, 0, 40), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1, true)
end)

settingsButton.MouseLeave:Connect(function()
	print("tweened 2")
	settingsButton.Frame:TweenSize(UDim2.new(0, 3, 0, 40), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.6, true)
end)
1 Like

Alright thank you so much! It worked!

1 Like

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