i read most of ore deposits related to magma origin the sulfur play a critical role to form these ore, first of all chemically what make S behave as former inside magma , as magma has a lot of elemnts too
Most metallic minerals are sulphides, such as galena and pyrite.
Sulphur originally was organic matter, was subducted and present at depth where magma forms. Metals are also present in the same area from subducted crust. Therefore, it is a happy combination of the two.
Sulfur would have several source in magmatic system. 1) From sediments and organic matter-bearing sediment that subducted beneath continetal crust; 2) From SCLM (sub continental lithospheric mantle) that have sulfuric and chalcophile nature; 3) From evaporatic, pyritic and organic matter sedimentary rocks that magma pass through them.
In the other hand metals in magma would provided by SCLM (in copper porphyry deposits) or from continental crust (in S-W porphyry deposits); and this related to metal nature (chalcophile or lithophile).
You can see nature of elements in "Goldschmidt classification"