@LeakyNun there's another way to define group schemes (affine or not) which I actually prefer. So basically by a Yoneda argument, we can view any scheme over $k$ as a functor $F:k-\mathbf{Alg} \to \mathbf{Set}$ by looking at some Hom-functor.
One can show, by a Yoneda exercise I won't spoil for you that having a group object is equivalent to having a functor $\tilde{F}: k-\mathbf{Alg} \to \mathbf{Grp}$ such that $\tilde{F}$ composed with the forgetful functor $\mathbf{Grp} \to \mathbf{Set}$ is $F$