MouseLeave Function Not working properly!

I’m trying to add buttons animations when hover with mouse. But the problem is that the size gets stuck, the mouse leave function isn’t doing the job very well when I move my mouse quickly over it. Everything is fine when I move it slowly. I’m using the mouse leave and enter functions. and I’m using button:TweenSize inside it. I have tried searching for help on internet, and I did find devforum posts about it but I didn’t get any help from it and these people didn’t seem to have found answer either. If you know any posts with a resolve to the problem please help. And what do the other games use because it work for them?
robloxapp-20240629-1849490.wmv (2.6 MB)

1 Like

Could you show me your code for those buttons

Well ok, even though like I said there is nothing complex its just mouseleave function and changing it back to normal size.

script.Parent.MouseLeave:Connect(function()
	script.Parent:TweenSize(
		UDim2.new(0, 60, 0, 60), 
		Enum.EasingDirection.Out, 
		Enum.EasingStyle.Linear, 
		0.1
	)
end)

There’s an override parameter for guiobject:TweenSize() that you’ll probably have to turn on. But since TweenSize is deprecated i’d recommend using tween service instead

local TweenService = game:GetService("TweenService")

local MouseLeaveTween = TweenService:Create(
    script.Parent,
    TweenInfo.new(0.1, Enum.EasingStyle.Linear),
    {Size = Udim2.fromOffset(60, 60)}
)

script.Parent.MouseLeave:Connect(function()
    MouseLeaveTween:Play()
end)
2 Likes

ty, it really help. I will try to remember that!

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