Detect direction MouseLeave went

I was wondering if there was a way to detect when the mouse leaves from (in this case) a SurfaceGUI and if the mouse exited from the left side then the it would print the same direction.

local frame = -- path to frame

frame.MouseLeave:Connect(function(x)
	if x < frame.AbsolutePosition.X then
		print("Left")
	end
end)
3 Likes