How do I stop this when the mouse leaves the fame?
function tweentrans()
repeat wait()
print("OnFrame")
until Box.MouseLeave:connect()
print("leave")
end
script.Parent.MouseEnter:connect(tweentrans)
How do I stop this when the mouse leaves the fame?
function tweentrans()
repeat wait()
print("OnFrame")
until Box.MouseLeave:connect()
print("leave")
end
script.Parent.MouseEnter:connect(tweentrans)
I would use a variable called inFrame, that becomes true when mouseEnter, and false on mouseLeave.
inFrame = false
function tweentrans()
repeat wait()
print("OnFrame")
until inFrame == false
print("leave")
end
script.Parent.MouseEnter:connect(function()
inFrame = true
tweentrans()
end)
script.Parent.MouseLeave:connect(function()
inFrame = false
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
This method is inconsistent. If you hover long enough it can keep going after the mouse leaves the frame.