Let $X$ be a scheme. I have heard sometimes that $\mathcal{O}_{X}(X)$ are the global functions of $X$. What are the "global functions"? Is this ture? If yes why? Is there a proof of this?
I have seen for $A$ a $\mathbb{C}$-algebra and $X = \mathrm{Spec} \, A$ the following proof:
Since $X$ is affine we have that $\mathcal{O}_X(X) = A$. Furthermore we have as the global functions $\mathrm{Hom}(X, \mathbb{A}_\mathbb{C}^1)$ (why are these the global functions?). Then we conclude: $$\mathrm{Hom}(X, \mathbb{A}_\mathbb{C}^1) = \mathrm{Hom}(\mathrm{Spec} \, A, \mathrm{Spec} \, \mathbb{C}[X]) = \mathrm{Hom}(\mathbb{C}[X],A) = A$$ Hence $\mathcal{O}_X(X) = A$ are the global functions of $X$.
I agree with Joppy's comment, but I still think that your question is very reasonable. If you don't mind, I'll restate it:
I believe the answer is yes.
You already know how to prove it for the case where $X$ is affine. So I'll prove it for a slightly more difficult case where $X$ itself is not affine, but can be covered by two open affine subschemes $U$ and $V$ such that $U \cap V$ is also affine. The argument generalises easily to the general case. We will use the gluing property of morphisms (Hartshorne II.3, proof of Theorem 3.3, Step 3).
So suppose we are given a $\mathbb C[X]$-algebra morphism $g : \mathcal O_{\mathbb A_{\mathbb C}^1}(\mathbb A_{\mathbb C}^1) \to \mathcal O_X(X)$. We would like to prove that $g = \alpha(f)$ for some $({\rm Spec \ }\mathbb C)$-morphism $f : X \to \mathbb A_{\mathbb C}^1$. To construct $f$, our strategy is to construct $f$ locally on the affine patches $U$ and $V$, where we have a good understanding of the correspondence between $({\rm Spec \ } \mathbb C)$-scheme morphisms and $\mathbb C$-algebra morphisms. Then we must somehow glue these local morphisms together.
With this in mind, we will begin by composing $g$ with appropriate restriction morphisms to obtain $\mathbb C$-algebra morphisms $\rho_{X,U} \circ g : \mathcal O_{\mathbb A_{\mathbb C}^1}(\mathbb A_{\mathbb C}^1 ) \to \mathcal O_X(U)$ and $\rho_{X,V} \circ g : \mathcal O_{\mathbb A_{\mathbb C}^1}(\mathbb A_{\mathbb C}^1) \to \mathcal O_X(V)$. Restricting a second time to $U \cap V$, we find that $\rho_{U, U \cap V} \circ \rho_{X,U} \circ g $ and $\rho_{V, U \cap V} \circ \rho_{X,V} \circ g$ are equal as morphisms $\mathcal O_{\mathbb A_{\mathbb C}^1} (\mathbb A_{\mathbb C}^1 ) \to \mathcal O_X(U \cap V)$.
Since $U$ and $V$ are affine, the $\mathbb C$-algebra morphisms $\rho_{X,U} \circ g$ and $\rho_{X,V} \circ g$ correspond to morphisms of $({\rm Spec \ } \mathbb C)$-schemes $f_U : U \to \mathbb A_{\mathbb C}^1$ and $f_V : V \to \mathbb A_{\mathbb C}^1$. The fact that $\rho_{U, U \cap V} \circ \rho_{X,U} \circ g$ and $ \rho_{V, U \cap V} \circ \rho_{X,V} \circ g$ are equal implies that $f_U$ and $f_V$ agree on the overlap $U \cap V$. By the gluing lemma for scheme morphisms, we learn that $f_U$ and $f_V$ can be glued together to form a single $({\rm Spec \ }\mathbb C)$-scheme morphism $f : X \to \mathbb A_{\mathbb C}^1$ whose restrictions to $U$ and $V$ are $f_U$ and $f_V$.
It is simple to see that the $\alpha(f) = g$. Indeed, $ \rho_{X,U} \circ \alpha(f) = \rho_{X,U} \circ g$ and $\rho_{X,V} \circ \alpha(f) = \rho_{X,V} \circ g$ by construction, hence by the sheaf condition, it follows that $\alpha(f) = g$. This proves surjectivity of $\alpha$.
To prove injectivity of $\alpha$, suppose $\alpha(f) = \alpha(f')$. Then $\rho_{X,U} \circ \alpha(f) = \rho_{X,U} \circ \alpha(f')$ and $\rho_{X,V} \circ \alpha(f) = \rho_{X,V} \circ \alpha(f')$, which implies that $f_U = f'_U$ and $f_V = f'_V$, where, as before the subscripts denote restriction to $U$ and $V$. So both $f$ and $f'$ are obtained by gluing together the morphisms $f_U$ and $f_V$. By the "uniqueness" clause in the statement of the gluing lemma, we learn that $f = f'$, so $\alpha$ is injective.