Dirt on glass is black instead of colored, or no opacity at all

I forgot to say, that’s how I did it. They share the same base color, roughness and metallic map, but the object have two different materials, one for the glass part, and the other for the plastic and metallic parts.