Suppose we have an integral (reduced and irreducible) affine curve $X$ over an algebraically closed field $k$. Suppose $t=\frac{f}{g}$ is a rational function on $X$ such that there exists an $n\in \mathbb{N}$ such that $t^n=(\frac{f}{g})^n$ is a regular function, i.e., $t^n\in \Gamma(X,\mathcal{O}_{X})$ (the coordinate ring or ring of regular functions on $X$). Does this imply that $t$ itself is a regular function?
Note that if the curve is non-singular, this is immediate, as in this case $\Gamma(X,\mathcal{O}_{X})$ is a UFD and hence $b^n|a^n$ implies $b|a$ in $\Gamma(X,\mathcal{O}_{X})$. But is this true in general for an integral affine curve?