This exercise is false as stated - if $R$ is not a sufficiently nice ring, then there is no hope of this at all. We'll outline how this exercise is probably supposed to be solved at the level of the other part of the question, and then discuss the general situation at the end of the post.
Proof using Cech cocycles: Assume $R$ is sufficiently nice (we'll say what we mean by this later - for now, know that "nice" includes being a domain). Write $\Bbb P^1_R=\operatorname{Proj} R[x_0,x_1]$ and $\mathcal{F}$ for our invertible sheaf. Then we claim that $\mathcal{F}$ is trivial when restricted to the standard affine opens $D(x_0)$ and $D(x_1)$. This is because every invertible sheaf on any affine space over $R$ for a sufficiently nice ring $R$ is trivial (that is, isomorphic to the structure sheaf). So the data of the gluing cocycle on $D(x_0x_1)$ is the only thing that specifies this sheaf.
It remains to identify what this cocycle can possibly be. We need it to be an invertible element in $R[\frac{x_1}{x_0},\frac{x_0}{x_1}]=R[x,x^{-1}]$ (the functions on $D(x_0x_1)$). We can write every element in this ring as a fraction $ \frac{p(x)}{x^n}$ for some polynomial $p(x)$ and some nonnegative integer $n$. It is then clear that if this expression is invertible, it's inverse is $\frac{x^n}{p(x)}$. Write $p(x)=x^mq(x)$ where $q(x)$ has nonvanishing constant term. $p(x)$ is invertible inside $R[x,x^{-1}]$ iff $q(x)$ is, so now we analyze this case.
The inverse of $q(x)$ cannot have any terms of positive degree in $x$: if it did, multiplication by the highest degree part of $q(x)$ would give a surviving term of positive degree in the product $q(x)\cdot(q(x))^{-1}$, which is a contradiction. Similarly, the inverse cannot have any terms of negative degree in $x$ either: multiplication by the constant term would give a surviving term of negative degree in $x$ in the product, again a contradiction. (These two statements are where we use $R$ a domain.) So the inverse of $q(x)$ is just a constant in $R$, and by uniqueness of inverses, we have that $q(x)$ is just a unit $r\in R$ and the cocycle is of the form $rx^d$ for some integer $d$. We can now get rid of the $r$ by multiplying sections on one open by $r$, which is an isomorphism as $r$ is a unit.
So our cocycle is of the form $\left(\frac{x_0}{x_1}\right)^d$ for some integer $d$ and as two invertible sheaves trivial on the same covering with the same cocycles are isomorphic, our invertible sheaf $\mathcal{F}$ is some $\mathcal{O}(d)$ and we're done.
Promised discussion of the issues with this exercise: Every invertible sheaf on $\Bbb P^n_S = \Bbb P^n_\Bbb Z \times_\Bbb Z S$ is of the form $p_1^*(\mathcal{O}_{\Bbb P^n_\Bbb Z}(n)) \otimes p_2^*(L)$ for $L$ an invertible sheaf on $S$ - see here, with a reference to Mumford's Geometric Invariant Theory and some other helpful discussion). So if $S$ has more interesting invertible sheaves (for example, take $S=\operatorname{Spec} R$ with $R$ an affine model of a curve of genus $>0$ or your favorite Dedekind domain) then there is no hope for what you want to be true.
Clearly we should want "$R$ nice" to mean $Pic(R)=0$, and then we also use "niceness" in the statement that every invertible sheaf on $\Bbb A^n_R$ should be trivial. This gives us some hints about what collection of properties we really want when we say "$R$ nice". First, $R$ should be a domain, as otherwise we could do silly things that are different on each irreducible component. Next, if $R$ is normal, then $Pic(R)=Pic(R\times \Bbb A^1)$ (see here, though the argument is a little involved), so normal plus domain plus vanishing Picard group will work.
One example of a class of rings satisfying these conditions where we can prove the niceness properties a little more easily is noetherian UFDs - this just requires some material from Hartshorne chapter II section 6. Briefly, the property of being a UFD is equivalent to normal + vanishing class group, we have an isomorphism $Cl(X)\cong Cl(X\times \Bbb A^1)$ for noetherian integral normal separated $X$, and for any noetherian integral separated locally factorial scheme, the class group and the Picard group coincide, so our argument works.