If I play a spell that makes an opponent discard a card, but they have no cards in their hand, would they have to discard those cards from their library, or would nothing happen?
He is instructed to discard a card.
701.7a To discard a card, move it from its owner’s hand to that player’s graveyard.
It's impossible for him to discard a card, so he does as much as possible.
609.3. If an effect attempts to do something impossible, it does only as much as possible.
It does not affect him.