If $G$ is a group scheme over $S$ acting on an $S$-scheme $X$, I'd like to understand the algebra of invariants $(\mathcal{O}_X)^G$. Specifically, I'd like to understand its relation to invariants $(\mathcal{O}_X)^{G(S)}$.
To simplify notation, say everything is affine: $G = \operatorname{Spec}R$, $X = \operatorname{Spec}A$, and $S = \operatorname{Spec}k$, where $k$ is an arbitrary ring (not necessarily a field). If it helps we can assume $G$ is smooth. We work in the category of $k$-schemes.
The action is given by a map $\sigma : G\times X\rightarrow X$. Let $p : G\times X\rightarrow X$ be the projection map. Then there is a natural bijection $A = \operatorname{Hom}(X,\mathbb{A}^1)$, and by definition the subalgebra of invariants $A^G$ is the set of $f\in A$ whose corresponding map $F : X\rightarrow\mathbb{A}^1$ satisfies $$F\circ\sigma = F\circ p$$ Via $\sigma$, the group $G(k)$ acts on $X(k)$, and for any $k$-scheme $T$, $G(k)$ maps to $G(T)$ and hence also acts on $X(T)$, so $G(k)$ acts on $X$. Thus, we may also consider the ring of invariants $A^{G(k)}$. Certainly we have $$A^G\subset A^{G(k)}$$ My main question is: What is the clearest way to express this relationship? I'm looking for a statement of the form $f\in A$ is $G$-invariant if and only if it is fixed by $G(k)$ and some other conditions.
I think one can say that $$A^G = \{f\in A| f\otimes_k 1\in A\otimes_k B \text{ is fixed by $G(B)$ for every $k$-algebra $B$}\}$$ Is this correct? Is it possible to further restrict the class of $B$'s that you have to consider? Are there other ways of thinking about this?