5. Square $A B C D$ and square $A B E F$ are in planes that form a $120^{\circ}$ angle, $M$ and $N$ are points on the diagonals $A C$ and $B F$ respectively, and $A M=F N$. If $A B=1$, then the maximum value of $M N$ is $\qquad$
5.1.

As shown in Figure 2, draw $M P \perp A B$ at $P$, and connect $P N$. It can be proven that $P N \perp A B$. Thus, $\angle M P N=120^{\circ}$.
Let $A M=F N=x$.
Therefore, $\frac{M P}{1}=\frac{A M}{\sqrt{2}}$,

which means $M P=\frac{\sqrt{2}}{2} x$.
Hence, $P N=\frac{\sqrt{2}-x}{\sqrt{2}}\left(\frac{P N}{1}=\frac{B N}{\sqrt{2}}=\frac{B F-N F}{\sqrt{2}}=\frac{\sqrt{2}-x}{\sqrt{2}}\right)$.
Then, $M N^{2}=M P^{2}+P N^{2}-2 P M \cdot P N \cos 120^{\circ}$
$$
\begin{array}{l}
=\frac{x^{2}}{2}+\left(\frac{\sqrt{2}-x}{\sqrt{2}}\right)^{2}-2 \frac{\sqrt{2}}{2} x \cdot \frac{\sqrt{2}-x}{\sqrt{2}} \cos 120^{\circ} \\
=\frac{1}{2}\left(x^{2}-\sqrt{2} x+2\right) \\
=\frac{1}{2}\left(x-\frac{\sqrt{2}}{2}\right)^{2}+\frac{3}{4}(0 \leqslant x \leqslant \sqrt{2}) .
\end{array}
$$

When $x=0$ or $x=\sqrt{2}$, $M N_{\text {max }}=1$.