If $X=Spec(A)$, we have $X_ \text {red}=Spec(A_\text {red})$, where $A_{\text {red}}=A/\text{Nil(A)}$ so that:
$\Gamma(X,\mathcal O_X)=A$
but
$\Gamma(X_{\text {red}},\mathcal O_{X_ \text {red}})=A_{\text {red}}=A/\text{Nil(A)}$
No contradiction with Hartshorne's 2.2.2.(c)!
Edit: some details
Here are some statements which might help shed light on this subtle question.
a) Given a scheme $X$ we associate to it the quasi-coherent sheaf of ideal $\mathcal N\subset \mathcal O_X$ defined for an arbitrary open subset $U\subset X$ by $$\mathcal N(U)=\{f\in \mathcal O_X(U)\mid \forall x\in \mathcal O_{X,x },\; f_x \in \text {Nil}(\mathcal O_{X,x }) \}$$ b) The scheme $X_{\text {red}}$ has structure sheaf $\mathcal O_{X_{\text {red}}}=\mathcal O_X/\mathcal N$
c) For any affine subset $U=\text {Spec} (A)\subset X$, we have $ \text {Nil}(\Gamma(U,\mathcal O_X))=\mathcal N(U)=\text {Nil}(A)$
d) For any affine subset $U=\text {Spec} (A)\subset X$, we have $\mathcal O_{X_{\text {red}}}(U)=A_{\text {red}}=A/{\text {Nil}} (A)$
e) For a general open subset $U\subset X$ , we have $ \text {Nil}(\Gamma(U,\mathcal O_X))\subset \mathcal N(U)$
but the inclusion may be strict for non-affine $U$:
Let $X_m=\text {Spec}(\mathbb C[T]/T^m)=\text {Spec}(\mathbb C[\epsilon _m])$ and $X=\bigsqcup X_m$ (a non-affine scheme).
Then $\Gamma(X,\mathcal O_X)=\prod \Gamma(X_m,\mathcal O_{X_m})=\prod \mathbb C[\epsilon _m]$ and for $\epsilon=(\epsilon_1,\epsilon_2,\cdots)$ we have $\epsilon \notin \text {Nil}(\Gamma(X,\mathcal O_X))$ although $\epsilon \in \mathcal N(X)$.
Hint for the forward direction: If $X$ is not irreducible, that means there are two disjoint nonempty open subsets $U,V\subset X$. Consider $\mathscr{O}_X(U\cup V)$.
Hint for the reverse direction: If $X$ is irreducible and reduced, so is any open subscheme of $X$, so every nonempty affine open subscheme of $X$ is Spec of a domain. To show $\mathscr{O}_X(U)$ is a domain for arbitrary $U$, you can show that the restriction $\mathscr{O}_X(U)\to\mathscr{O}_X(V)$ is injective for any nonempty affine open subset $V\subseteq U$.
A stronger hint for the reverse direction is hidden below:
To show the restriction $\mathscr{O}_X(U)\to\mathscr{O}_X(V)$ is injective, suppose $f$ is in its kernel. Then $f$ vanishes on $V$. To show $f$ vanishes on $U$, it suffices to show $f$ vanishes on $W$ for every other affine open $W\subseteq U$. Now use the fact that $W$ is Spec of a domain and $f$ vanishes on $V\cap W$.
Best Answer
As Stahl says it suffices to have some non reduced scheme $X$ with global sections ring $\mathcal{O}_X(X)$ non reduce. The example given here is perfect: $X=\operatorname{Proj}k[s,x_0,x_1]/(s^2)$ is not reduce because with $$U=D_+(x_0)=\operatorname{Spec}\left(k\left(\frac{s}{x_0},\frac{x_1}{x_0}\right)/\left(\left(\frac{s}{x_0}\right)^2\right)\right)$$ one has $\mathcal{O}_X(U)$ not reduced but the global sections ring $\mathcal{O}_X(X)$ is reduced because $$\mathcal{O}_X(X)=k$$ se the link above.