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

Help with MouseEnter and MouseLeave?

Asked by 9 years ago

I have this script, and it works fine, but when I hover over it too quickly, it stays on mouseEnter until I put my mouse on it again to fix it. Any help?

framebutton.MouseEnter:connect(function()
active = true
    local keyConnection = framebutton.MouseLeave:connect(function()
        open:TweenPosition(UDim2.new(-0.07,0,0.51,0),EasingDirection,EasingStyle,float)
        active = false
    end)
    open:TweenPosition(UDim2.new(-0.05,0,0.51,0),EasingDirection,EasingStyle,float)
    repeat wait () until active == false
    keyConnection:disconnect()
end)

1 answer

Log in to vote
0
Answered by
Prioxis 673 Moderation Voter
9 years ago

It looks like the MouseLeave function is under the same function for MouseEnter

Try this for the script

framebutton.MouseEnter:connect(function()
active = true
        open:TweenPosition(UDim2.new(-0.07,0,0.51,0),EasingDirection,EasingStyle,float)
    end)

 framebutton.MouseLeave:connect(function()
        active = false
    open:TweenPosition(UDim2.new(-0.05,0,0.51,0),EasingDirection,EasingStyle,float)
end)

that should fix the issue hope I helped! :D

0
If I helped you and it works for you now please accept my Answer as a Answer it'll Increase my rep and your rep! :D Prioxis 673 — 9y
0
Attempted to index global value 'keyConnection' killerkill29 35 — 9y
0
try it now Prioxis 673 — 9y
0
I edited the script Prioxis 673 — 9y
View all comments (2 more)
0
thanks it worked! killerkill29 35 — 9y
0
No problem! :D Prioxis 673 — 9y
Ad

Answer this question