Claim: the conclusion holds for every sequence $(\mu_n)$ converging weakly to $\mu$ iff $f_n \to f$ uniformly.
Since $\mu$ is Radon and $X$ is compact, $\mu$ is a finite measure. Since $\mu_n(X) \to \mu(X)$ it follows that $sup_n \mu_n(X)<\infty$. So, if $f_n \to f$ uniformly then $\int f_n d\mu_n -\int fd\mu_n \to 0$ from which the conclusion follow easily.
Now suppose the conclusion holds for every sequence $(\mu_n)$ converging weakly to $\mu$. Let $x_n \to x$ and $\mu_n=\delta_{x_n}, \mu =\delta_x$. Then $\mu_n \to \mu$ weakly so $f(x_n)=\int f_n d\mu_n \to \int f d\mu=f(x)$. Since $X$ is compact the statement $f(x_n) \to f(x)$ whenever $x_n \to x$ is equivalent to uniform convergence of $f_n$ to $f$.
The function $g=\mathbb{1}_{(0,1)}$, which takes values $0$ outside $(0,1)$ and $1$ in $(0,1)$ will work for your purposes.
Notice that the points of discontinuities of $g$ is $\{0,1\}$, and $\mathbb{P}[X\in\{0,1\}]=1$. Furthermore, $Z_n=g(X_n)=1$ and $Z=g(X)=0$.
In terms of measures (no random variables involved) define the sequence of probability measures $\mu_n$ on $(\mathbb{R},\mathscr{B}(\mathbb{R}))$ as
$$\mu_n=\frac12\delta_{\frac1n}+\frac12\delta_{1-\frac1n}$$
For any $f\in\mathcal{C}_b(\mathbb{R})$ (here $\mathcal{C}_b(\mathbb{R})$ is the space of real valued bounded continuous functions on $\mathbb{R}$)
$$\int f\,d\mu_n=\frac12 f(1/n)+\frac12 f(1-1/n)\xrightarrow{n\rightarrow\infty}\frac12(f(0)+f(1))$$
Consequently $\mu_n\stackrel{n\rightarrow\infty}{\Longrightarrow} \frac12(\delta_0+\delta_1)=:\mu$.
With $g(x)=\mathbb{1}_{(0,1)}(x)$ on $\mathbb{R}$, and $f\in\mathcal{C}_b(\mathbb{R})$
$$\int f\circ g\,d\mu_n=\frac12\big(f(g(1/n))+f(g(1-1/n))\big)=f(1),\qquad n\geq2$$
Thus, $\mu_n\circ g^{-1}\Longrightarrow\delta_1$ however, $\mu\circ g^{-1}=\delta_0$. As I mentioned before, that set the points of discontinuity of $g$ is given by $D=\{0,1\}$, and $\mu(D)=1$.
Best Answer
Please notice following example. Let \begin{equation*} F_n(x)=\frac{[n(x^+\wedge 1)]}{n}, \quad n\ge 1,\qquad F(x)=x^+\wedge 1,\quad x\in\mathbb{R}, \tag{1} \end{equation*} $\mu_n,\mu$ be the measures generated by $F_n,F$ on $(\mathbb{R},\mathscr{B}_{\mathbb{R}})$ respectively. Then, as $n\to\infty$,
\begin{equation*} \mu_n\overset{w}{\to} \mu,\qquad F_n(x)\to F(x), \quad \forall x\in \mathbb{R}. \tag{2} \end{equation*} Also, let \begin{equation*} A_n=\Big\{\frac{k}{n}, k=0,1,\cdots,n\Big\},\quad n\ge1,\qquad A=\bigcup_{n\ge 1}A_n, \end{equation*} then $A_n,A$ are countable and \begin{gather*} \mu_n(A_n)=\mu_n(A)=1,\qquad n\ge 1, \tag{3}\\ \mu(A_n)=\mu(A)=0, \qquad n\ge 1. \tag{4} \end{gather*} (2)--(4) means that weak convergence (to a continuous distribution) does not imply "strong convergence" of measures.