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

Why does my GUI stop tweening when I move my mouse away quickly?

Asked by
N43FGXL 169
4 years ago

I'm trying to make it so when I hover my Mouse over the Gui button it will expand. This works but when I quickly move my mouse away before the tweening function (0.3 seconds) ends, it remains in its current state (expanded or contracted).

Here is my script for Gui Tweening:

local Bubbledebounce = false -----(Debounce)
script.Parent.MouseEnter:Connect(function() 
    if not Bubbledebounce then
        script.Parent:TweenSize(UDim2.new(0, 400,0, 400),"In","Quad",0.3)--When mouse enters object, it expands.
    end
    Bubbledebounce = true
end)

script.Parent.MouseLeave:Connect(function()
    if Bubbledebounce then
        script.Parent:TweenSize(UDim2.new(0, 350,0, 350),"Out","Quad",0.3)--When mouse leaves object, it contracts.
    end
    Bubbledebounce = false
end)

I hope you can help me.

Answer this question