Once again, this is fake astrophysics babble...
No one has ever seen a star being formed or how it could happen and why...
We only see stars dying, nova’s and supernovae...
Where would the energy come from?
Also, Gases do not come together to form solids...
It goes against the Gas laws...
We really only had the tools to carefully look at the heavens until lately. We do have records of visual observations that go back perhaps 4000 years or so. That said, we have the tools now it is happening all around us! Jupiter is a large gas giant that does not have enough quite enough pressure to start fusion. Its essentially a pre-star, just gathering material and gas, waiting for the right time....Dust and gas lanes in distant galaxie are star nurseries....
"Also, Gases do not come together to form solids... It goes against the Gas laws..."
Well...
https://en.wikipedia.org/wiki/Metallic_hydrogen
https://undecidedmf.com/episodes/solid-hydrogen-explained-again-is-it-the-future-of-energy-storage/
Um. water vapor...ice.
Unless you mean the pressures inside a star that result in fusion that progressively produces the other elements. (Not getting into that.)