Suppose a group G acts on a variety X and a quotient exists, that is, we have a variety Y and a regular map $\pi : X \rightarrow Y$ so that any regular map $\varphi :X \rightarrow Z$ to another variety Z factors through $\pi$ if and only if $\varphi (p) = \varphi (g(p)) \forall p \in X, g \in G$.
I'm trying to prove that the points of Y correspond to orbits of G on X, i.e.
$\pi (p) = \pi (q) \iff \exists g \in G: g(p) = g(q) $
However, I am stuck. The only triviality I was able to show is that, assuming $\pi (p) = \pi (q)$, we'd have $\pi (g_1(p)) = \pi (g_2(q)) \forall g_1, g_2 \in G$. I guess it boils down to choosing the right variety Z and then make use of the fact that Y is a quotient, but I don't know how. I'd be grateful for any hints.
EDIT: I just realized I have a bad typo in this post. $g(p) = g(q)$ should be $g(p) = q$ , sorry!!