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

Why is my TextButton not tweening correctly upon fast moving cursor?

Asked by
Thetacah 712 Moderation Voter
6 years ago

The following script basically just tweens the menu buttons upon MouseEnter and MouseLeave.

Now for some reason, when hovering over them fast, they sometimes get stuck at the bigger size.(When I leave it, it stays big instead of shrinking.)

Anyone know why this is happening/ how to fix?

function tweenSize(value,size)
    print("Tweening"..value.Text)
    repeat 
        wait()
        value:TweenSize(size,"Out", "Quad", .1);
    until 
    value.Size == size;
end;

function mouseLeftMenu(value)
    print(value.Text.." has left")
    value.TextColor3 = Color3.new(colornumbersarehashed);
    tweenSize(value, UDim2.new(.4, 0, .2, 0));

end;

function mouseEnterMenu(value)
    print(value.Text.." has entered")
    value.TextColor3 = Color3.new(0,0,0);
    tweenSize(value, UDim2.new(.45, 0, .25, 0));
end;
for i, v in pairs(menuHolder:GetChildren()) do
    v.MouseEnter:connect(function()
        mouseEnterMenu(v);
    end)
    v.MouseLeave:connect(function()
        mouseLeftMenu(v);
    end);
end;

1 answer

Log in to vote
0
Answered by
Azarth 3141 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Change your first function to this and see if it still happens. The true makes it so you can override a previous tween without having to wait for it to finish, which was causing your problem when using repeat wait().

function tweenSize(value,size)
    print("Tweening"..value.Text)
    value:TweenSize(size,"Out", "Quad",  .1, true);
end;
0
Much thanks, Azarth. Thetacah 712 — 6y
Ad

Answer this question