Is there any way to detect input for when a player mouse leaves a gui?

So I’m trying to make an animation for when a player mouse leaves a gui on their screen, the only problem is that I didn’t find anything inside Enum.UserInputType or Enum.UserInputState that detects that kind of input.

There’s a similar input for Enum.UserInputType.MouseMovement but as you probably know that only detects input when the mouse is moving inside the gui. Not when it’s leaving the gui.

There’s a solution I found where I could do:

TextLabel.MouseLeave:Connect(function()
 -- TweenService etc
end

But that poses 2 problems.

  1. It needs me to create an entire function just so that I can use a single line of code.

Do I really need to go to an entire effort of creating an entire function just for a single line of code? Why can’t it just be inside of an InputBegan(input) event? I hear people go on and on about how ContextActionService is better than UserInputService which it probably is but I highly doubt that solves my problem. And

  1. I hear that it’s not supported? I remember seeing something about it somewhere not sure if it’s actually true.

I really do not want my game to be buggy or closed down because I was using codes that Roblox doesn’t want me to use. So far I have not found a question related to this in the forum or developer.

Roblox won’t shut down games for using Deprecated functions? They just either are not supported, stopped working or are buggy.

As for the actual question, I don’t have another way of detecting MouseLeave. Depending on your use case it might not end up being buggy at all. You should try it first and see if it generates any issues.

It doesn’t appear to but it kinda of makes my code difficult to read. It’s like that little smudge on your screen you often see but don’t know how it got there and why it’s there until you spend 5 seconds looking at it and finding out.

In both ways beside MouseLeave you would also need to make another function. So there is no difference but making it more difficult.