LDG's suggestions are good, as usual. I have no personal experience with this topic, but I have repeatedly heard the following suggestions made:
● Use upside-down carpet runner or tin foil to cover the area where they're scratching. Ditto for double-sided sticky tape that you'd place on top of some smooth, removable platfom. Most cats will not like the feel of any of these surfaces and will therefore learn to avoid them. This is probably the easiest and cheapest of all the methods that I will list, and has the fewest drawbacks IMO.
● You might also try a scat mat, which emits an uncomfortable (but harmless) shock/vibration when the cats walk on it. Some people are understandably opposed to this method though.
● There is also a product called ssscat, which is basically a can of compressed air (like what you'd use to clean the dust and dirt from your computer keyboard) with a motion sensor. You'd strategically place it on the floor outside your bedroom before going to bed, and when your cats walk into the "line of fire" so to speak, ssscat emits a short and harmless burst of air which should scare them away.
● Lastly, some people have recommended bringing your vacuum cleaner into your bedroom, turning it on, but leaving it unplugged. When your cats start to scratch and claw at the carpet, plug the vacuum cleaner in for a few seconds. After a few incidents, they hopefully will soon learn to associate the carpet scratching with the (presumably) unpleasant sound of the vacuum cleaner --- and they won't even blame you for scaring them. Of course, logistically this might not even be possible for you. And some people, like me, wouldn't be able to go back to sleep easily after having fully awakened by a loud noise like that.
Hopefully one or more of these will do the trick for you. I'm sure there are numerous other ideas as well. Obviously different cats react differently to different things. As an aside, I would think that if your cats are at all skittish then you probably would not want to use ssscat or the vacuum cleaner.