Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why dosen't MouseEnter really work like it should?

So if you move the mouse fast over the gui the frame that tweens stays on the same spot when the mouse leaves why?

script.Parent.ButtonsHolder.Shop.MouseEnter:connect(function()
	wait(0.01)
	script.Parent.ButtonsHolder.Shop.Frame:TweenPosition(UDim2.new(0, 100,0, 10),"Out", "Bounce", 0.2)
end)

script.Parent.ButtonsHolder.Shop.MouseLeave:connect(function()
	wait(0.01)
	script.Parent.ButtonsHolder.Shop.Frame:TweenPosition(UDim2.new(0, 0,0, 10),"InOut", "Quad", 0.2)
end)

1 answer

✓ Accepted answer

Hey ObStactionD3stroy4r,

The fix for this issue is quiet simple, actually. All you need to do is, use the second last parameter of the :TweenPosition/Size/SizeAndPosition function. By default, it's set to false, it's the over-ride boolean. It allows the tween that the Gui is currently going through, to be overriden. So, I'll show you an example below and link you to the wiki page.

local gui = script.Parent;

gui:TweenPosition(UDim2.new(0, 0.05, 0, 0.1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 2, true);
gui:TweenSize(UDim2.new(0, 0.2, 0, 0.3), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 2, true);
gui:TweenSizeAndPosition(UDim2.new(0, 0.2, 0, 0.3), UDim2.new(0, 0.05, 0, 0.1), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 2, true);

###Here is the wiki page you can look at for the parameters of :TweenSizeAndPosition.

##Well, I hope I helped and have a nice day/night.

~~ KingLoneCat

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.