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

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

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

✓ Accepted answer

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;

1 comment

0

Much thanks, Azarth.

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