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

The GUI no longer shrinks automatically when the mouse leaves it. How can I improve it ?

Asked by 3 years ago

I should enlarge the "object" by 20 pixels when the mouse is on it. When the mouse leaves the object, it should return to its original length. The problem now is that if I move the mouse out of the object while it is being enlarged, it stays at this size and no longer shrinks to its original size.

This is my code:

local object = script.Parent

object.MouseEnter:Connect(function(x,y)
    object:TweenSize(UDim2.new(0, 120, 0, 100))
end)

object.MouseLeave:Connect(function(x,y)
    object:TweenSize(UDim2.new(0, 100, 0, 100))
end)

Answer this question