Why is the metallicity of the sun so low when they are so high for the planets?
small thing (say up to size of smaller planets): only solids can clump together and stay together, gas would just fizz away
medium thing (earthish to gas giantish, say): solids clump together and that provides enough gravity (and sometimes magnetics) to capture/keep some gas too
large thing (star sized): you can just capture everything around. Sure that'll contain some metal, but since most of what's out there is H2 and you're gulping it all up, you end up mostly gas
"...heavy elements (elements other than hydrogen and helium) are distributed within a region extending to nearly half of Jupiter’s radius."