Let $X$ be a Hausdorff topological space and $R$ a unital commutative ring with a discrete topology. Let $C_{R}(X)$ be the set of $R-$valued continuous function (i.e., locally constant) with compact support. Then, every $f\in C_{R}(X)$ may be written as $$f=\sum_{i=1}^{n}r_{i}1_{D_{i}}\quad \text{where }r_{i}\in R\text{ and the }D_{i}\text{ are compact open, pairwise disjoint subsets of }X.$$
My attempt:
If $D$ is a compact open subset of $X$, $1_{D}$ is clearly an element of $C_{R}(X)$. Let $f\in C_{R}(X)$ and $A=\{r\in R\mid \exists x\in X \quad f(x)=r\}$ then $C=\{U_{r}=f^{-1}(\{r\})\mid r\in A\}$ is an open cover of $X$ and therefore $C\setminus \{U_{0}\} $ is an open cover of $supp(f)$ then for compactness has a finite subcover $\{U_{r_{i}}\}_{i=1}^{n-1}$. If $U_{0}:=U_{r_{n}}$ then $$f=\sum_{i=1}^{n}r_{i}1_{U_{i}}$$ but, I don't know if the $U_{r_{i}}$'s are compact. I appreciate your suggestions.
You're on the right track!
Your idea is to look at $f^{-1}(\{r\})$ for each $r \neq 0$ in the image of $f$. Since $\text{Supp}(f)$ is compact, and each $\{r\}$ is open, finitely many of these are enough, so we can write $\sum_{r \neq 0} r \cdot \mathbf{1}_{f^{-1}(\{r\})}$ as a finite sum. As you've said, $f^{-1}(\{r\})$ is open, so to finish the problem, we need to know that it's also compact.
But there's more we can say about $\{r\}$ when the topology on $R$ is discrete! In fact, $\{r\}$ is closed too (do you see why?) So $f^{-1}(\{r\})$ is also closed in $X$. But we know that $f^{-1}(\{r\}) \subseteq \text{Supp}(f)$, which is compact (and hausdorff, which it inherits from $X$)... Do we know anything about closed subsets of compact hausdorff spaces that might help here?
I hope this helps ^_^