This is not true. The most prominent examples of non-residually finite central extensions of residually finite groups (by $\mathbb Z$) are certain lattices in non-linear Lie groups.

See for example

M. S. Raghunathan. Torsion in cocompact lattices in coverings of Spin(2, n). Math. Annalen 266, 403–419, 1984.

or

P. Deligne. Extensions centrales non residuellement finies de groupes arithmetiques. CR Acad. Sci. Paris, serie A-B, 287, 203–208, 1978.