I have seen some articles and lectures that state but i cant seem to put my finger on on how does density affect composition and how are you able to determine composition from exoplanet density.
You can't get an exact composition just from density, but it is a clue.
In our solar system there are "rocky" planets with a density of about 5 to 6 g/cm³
And there are gas planets with a density of between 0.5 and 2 g/cm³
So if an exoplanet is found to have a density of 5.3 g/cm³ and a fairly small mass we can guess that the composition is rock (probably siliates with an iron core just like the rocky planets in our solar system) And if the density is 1.1 g/cm³ we can guess that the planet is made of gasses like hydrogen and helium, perhaps with "ices" like methane or H₂O. If the mass is much greater than that of Jupiter, then the planet is likely be be a (sub)-brown-dwarf.
You need both the mass and the density to make this judgement, as the density of gas giants depends on their mass, and larger gas giants have a greater density.