So it is spinning but as soon as it encounters resistance on the carpet it stops?
You probably need a new head. There is a small vacuum driven turbine inside the head and it tends to crack and slip on the shaft eventually. It’s not something you can see or easily access.
As long as suction is good, and the round side valve (if fitted) is pulled out into the on position, if the roller stops when it encounters any resistance, replace the head.
I will share some advice from elsewhere on the site on buying one though:
We urge spare parts buyers to exercise great caution when buying any tool or cleaner head for these models as Dyson did a lot of playing around with different tool sockets and fittings at this time. Many otherwise seemingly identical machines can have differing tool sockets, and many people make mistakes when buying spare parts that involve a tool or tool/hose socket fitting.