Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why dosen't MouseEnter really work like it should?

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago

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

0
Thanks ObStactionD3stroy3r 14 — 6y
Ad

Answer this question