Continuity isn't needed if we invoke the Factor Theorem (FT) for a general root $\rm\,r\,$ (vs. root $\rm\,r= 0).$
Over a $\rm\,\color{#C00}{domain}\ D,$ assume a polynomial $\rm\, f\in D[x]\,$ has more roots than its degree. We prove by induction on degree $\rm\,f\,$ that all coefficients of $\rm\,f\:$ are $\,0.\,$ If $\rm\,f\,$ has degree $\,0\,$ then $\rm\,f\,$ is constant, say $\rm\:f = c\in D.\,$ Since $\rm\,f\,$ has a root, $\rm\,c = 0.\:$ So all coefficients of $\rm\,f\,$ are $\,0.\,$ Else $\rm\,f\,$ has degree $\ge 1,\:$ so $\rm\,f\,$ has a root $\rm\,r.\,$ By FT, $\rm\ f = (x\!-\!r) g,$ $\rm\: g\in D[x]. $ Too $\rm\,g\,$ has more roots than its degree, since all roots $\rm\,s \ne r\,$ are roots of $\rm\,g\,$ by $\rm\,(s\!-\!r)g(s) = 0,\,$ $\rm\,s-r\ne 0\,$ $\Rightarrow$ $\rm\,g(s)=0,$ by $\rm\color{#C00}{domain}\ D.\:$ Therefore, by induction, all coefficients of $\rm\,g\,$ are $\,0,\,$ hence $\rm\,f = (x\!-\!r)g\: $ has all coefficients $0.\ \ $ QED
As a corollary, if $\rm\,\deg f < |D|\,$ and $\rm\,f(D) = 0,\,$ then all coefficients of $\rm\,f\,$ are $\rm\,0,\,$ i.e. if $\rm\,f\,$ is zero as a function, then it is zero as formal polynomial. In particular this is true for any infinite domain $\rm\,D,\,$ so the ring of polynomial functions over an infinite domain $\rm\,D\,$ is isomorphic to the ring $\rm\,D[x]\,$ of formal polynomials over $\rm\,D.$
The proof fails over non-domains, e.g. $\rm\,x^2\!-\!1 = (x\!-\!1)(x\!+\!1)\,$ has $\,4\,$ roots $\,\pm1,\pm3\,$ over $\, \mathbb Z/8.\,$ Notice how the proof breaks down due to the existence of zero-divisors: notice $\,3\,$ is a root since $\,2\cdot4\equiv 0,\,$ but $\,3\,$ is not a root of either $\rm\,x\!-\!1\,$ or $\rm\,x\!+\!1;\,$ i.e. $\rm\,x\!-\!3\,$ divides $\rm\,(x\!-\!1)(x\!+\!1)\,$ but doesn't divide either factor, so it is a non-prime irreducible. This yields the nonunique factorization $\rm\,(x-3)(x+3)\equiv (x-1)(x+1).$