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

Glitchy MouseEnter & MouseLeave (EASY)?

Asked by 10 years ago
function hover_upperbar()
coroutine.wrap(function()
CollapseButton.BackgroundColor3 = Color3.new(0/255, 19/255, 24/255)
JoinLobbyButton:TweenPosition(UDim2.new(0.610,0,-0.05,0), Out, "Bounce", 0.3, false)
InventoryButton:TweenPosition(UDim2.new(0.691,0,-0.05,0), Out, "Bounce", 0.5, false)
StoreButton:TweenPosition(UDim2.new(0.775,0,-0.05,0), Out, "Bounce", 0.7, false)
end)()
end

function unhover_upperbar()
coroutine.wrap(function()
CollapseButton.BackgroundColor3 = Color3.new(0/255, 45/255, 56/255)
JoinLobbyButton:TweenPosition(UDim2.new(0.530,0,-0.05,0), Out, "Bounce", 0.3, false)
InventoryButton:TweenPosition(UDim2.new(0.530,0,-0.05,0), Out, "Bounce", 0.5, false)
StoreButton:TweenPosition(UDim2.new(0.530,0,-0.05,0), Out, "Bounce", 0.7, false)
end)()
end

UpperBar = game.Players.LocalPlayer.PlayerGui.Menu.Bar.Upper_Bar
UpperBar.MouseEnter:connect(hover_upperbar)
UpperBar.MouseLeave:connect(unhover_upperbar)

The problem is that this is VERY glitchy. When I enter my mouse slowly then all the buttons get tweened and appear, but when I enter my mouse super fast - then only some buttons appear. This is also the same for MouseLeave. How do I fix this so that all codes inside the function actually get executed before the function quits?

Answer this question