Please help

I got two very small hermit crabs from a pet store and they are in a tank with less substrate then preferred for the time being, however i’m pretty sure one passed away. He was missing half a leg and he was very very shy and he did move around and was starting to get some more color but I randomly checked on him because I had a weird feeling and he is not moving at all not even small twitches. He’s half way out of his shell and i moved him into a moss bit with a protein mix next to him just in case. But could he just be molting? (he was not dug up just siting in a coco hut.) It’s also important to know when i got him he was in a tank (less then 10 gal) with a 5 other crabs and less then a inch of coco fiber and he was very still then. But when he started eating better food he was getting more active.