Frame not tweening back on MouseLeave

Hey developers, I have been trying to make a TextButton that tweens back after the mouse leaves the button, there is no errors in the output, but if you quickly put your mouse over the TextButton it just stays there.

Script:

local hover = false

script.Parent.MouseEnter:Connect(function()
	if not hover then
		hover = true
	
		script.Parent.Frame:TweenSize(UDim2.new(0, 298,0, 43), 'InOut', 'Sine', .5)
	end
end)

script.Parent.MouseLeave:Connect(function()
	if hover then
		hover = false
		
		script.Parent.Frame:TweenSize(UDim2.new(0, 0,0, 43), 'InOut', 'Sine', 0.5)
	end
end)

Video

Hierarchy:
image

Any help, tips or suggestions would be greatly appreciated,
Thanks.

In your tweens, maybe add a parameter of true so that it can be overridden by other tweens. script.Parent.Frame:TweenSize(UDim2.new(0, 298,0, 43), 'InOut', 'Sine', .5, true)

1 Like