Does compact convergence preserves continuity? Let $X$ be a topological space, and $\mathbb{R}$ be the set of real numbers (with Euclidean topology). Let's think about functions from $X$ to $\mathbb{R}$. We say the functions $(f_n)_n$ compactly converges to $f$ iff for every compact subset $K\subset X$, $(f_n\restriction_K)_n$ converges uniformly to $f\restriction_K$.

Is there a continuous functions $(f_n)_n$ that converges compactly to noncontinuous function $f$ ?

I tried on $X\subset \mathbb{R}^n$ and proved that there are no counterexamples in $X\subset \mathbb{R}^n$. Here's my proof:
If $f$ is not continuous, then there's a point $x\in X$ where $f$ is not continuous at. You can take series of points $(x_n)_n$ in $X$ such that $x_n \to x (n\to \infty)$ but $f(x_n) \not\to f(x) (n\to \infty)$. The set $A=\{x\}\cup\{x_1,\ x_2, \cdots\}$ is bounded and closed in $\mathbb{R}^n$, so A is compact. Therefore $f$ must be continuous on A, since $(f_n)_n$ converges uniformly to $f$ on A.  This is a contradiction.

Is my proof ok?

 A: Continuity is a local question. So you can restrict your domain to a compact to study the continuity at a point $x$ of the limit.
As a sequence of continuous functions that converges uniformly on a compact has a continuous limit, then the limit is continuous at any point of your compact. This is truc for every compact, so the limit is continuous at any point, thus is continuous.
A: If $ X $ is compactly generated (especially if $ X $ is sequential or locally compact), a function on $ X $ is continuous if and only if it is continuous on every compact subset of $ X $, so your proof works.
However, there is a counterexample without any assumptions on $ X $. Let $ X $ be $ [0, 1] $ as a set, and give it the topology
$$
\{U \setminus C \mid \text{$ U $ is open in $ [0, 1] $ w.r.t. usual topology, and $ C $ is (at most) countable}\}.
$$
Then a compact subset of $ X $ is necessarily finite. To see this, let $ A $ be a infinite subset of $ X $ and take a sequence $ (x_n)_{n \in \mathbb{N}} $ of distinct points of $ A $. Here $ \{A \setminus \{x_n, x_{n + 1}, \dots\}\}_{n \in \mathbb{N}} $ is an open covering of $ A $ which has no finite subcoverings. Hence $ A $ is not compact. As a result, a sequence of functions on $ X $ compactly converges to $ f $ if and only if it simply (i.e., pointwise) converges to $ f $.
Define a continuous function $ f_n\colon X \to \mathbb{R} $ by letting $ f_n(x) = x^n $. Then $ (f_n)_{n \in \mathbb{N}} $ (simply and hence) compactly converges to such a function $ f $ that $ f(x) = 0 $ for $ x \in [0, 1) $ and $ f(1) = 1 $. $ f $ is not continuous since $ f^{-1}((0, \infty)) = \{1\} $ is not open in $ X $.
