Why do different metals produce flames of different colours?
Different elements have different flame colours because their electrons have different allowed energy levels.
The Bohr model says that electrons exist only at certain allowed energy levels.
When you heat an atom, some of its electrons are "excited* to higher energy levels.
When an electron drops from one level to a lower energy level, it emits a quantum of energy.
The wavelength (colour) of the light depends on the difference in the two energy levels.
We can see only those transitions that correspond to a visible wavelength.