Replacing carpet with vinyl plank
Follow the vinyl flooring manufacturer’s instructions. 

I doubt they recommend installing their flooring over old carpet, because the carpet can compress when loaded and deform their flooring. 

If you sit a table on the flooring for very long, 1) it will show a deformed area around the leg of the table from the weight of the table, and 2) it will not spring back into its original shape once the table is moved. 

I’d remove everything down to the slab/subfloor and fix anything (including possible moisture issues) that I find.