Solution (source code)

= Solution

A <morphism of schemes> $f:X\to Y$ defines a <natural transformation> $g_f:g_X\to g_Y$ by $u\mapsto f\circ u$. We construct the inverse correspondence.

Let $\alpha:g_X\to g_Y$ be a <natural transformation>, and choose an <affine open cover> $(j_i:U_i\hookrightarrow X)$. Regard $j_i$ as an element of $g_X(U_i)$ and set
$$
f_i=\alpha_{U_i}(j_i):U_i\longrightarrow Y.
$$
Here and below the <equivalence of categories> in the question lets us write the restricted <functor of points> on <affine schemes>, contravariantly, rather than on <commutative rings>, covariantly. If $W\subseteq U_i\cap U_j$ is an <affine open subscheme>, <naturality> for its two inclusions gives
$$
f_i|_W=\alpha_W(W\hookrightarrow X)=f_j|_W.
$$
Such $W$ cover the overlap even when that overlap is not an <affine scheme>. Consequently the $f_i$ agree and glue to a <morphism of schemes> $f:X\to Y$.

It remains to check all elements of the restricted <functor of points>, not only the chosen inclusions. Given an <affine scheme> $T$ and $u:T\to X$, cover each $u^{-1}(U_i)$ by <affine open subschemes> $V$. On such a $V$, factor $u|_V=j_i\circ v$. Applying <naturality> first to $v:V\to U_i$ and then to $V\hookrightarrow T$ gives
$$
\alpha_T(u)|_V=\alpha_V(u|_V)=\alpha_{U_i}(j_i)\circ v=f\circ u|_V.
$$
These local equalities prove $\alpha_T(u)=f\circ u$. The glued $f$ is unique, since its restrictions to all $U_i$ are prescribed. Hence
$$
\boxed{\operatorname{Hom}_{\mathsf{Sch}}(X,Y)\cong\operatorname{Nat}(g_X,g_Y),}
$$
so the assignment is <fully faithful>.

If $g_X\cong g_Y$, the <natural isomorphism> and its inverse correspond to <morphisms of schemes> $f:X\to Y$ and $h:Y\to X$. Their compositions induce the identity <natural transformations>, and faithfulness implies $hf=\operatorname{id}_X$, $fh=\operatorname{id}_Y$. Conversely, an <isomorphism of schemes> induces a <natural isomorphism>. Thus
$$
\boxed{X\cong Y\iff g_X\cong g_Y.}
$$