To a certain extent, I think most authors of all kinds have some kind of moral message they like to share. It's not so much duty as hubris. They feel like sending a moral message. Sometimes the moral message is what sells, as well as the entertainment. Shakespeare always made sure there was plenty of blood and sword fighting to keep everyone entertained.
In Shakespeare's time, I think this was a very valid goal. To entertain, but to provide more substance than a "bit with a dog", in order to attract audiences from all walks of life. However, that having been said, the observant viewer will be able to learn something from every piece he/she watches. The entertainment value is huge, but without something underlying to keep their attention and to attract them back to the theatre for future performances is tantamount.
Even "Waiting for Godot" teaches its audience something, though. The play is extremely existential in nature, and while it appears to be about 'nothing,' that is, in a sense, its entire point. The lesson it teaches us is a prime example of existential philosophy - an answer to the age-old question: what is the meaning of life?
I would say that arguably every playwrite at the very least attempts to teach as well as please.
This is a very opinion-based question, but I'll take a stab at it:
In order for a play to be effective, there should be a problem that must be solved, and the resolution of the problem often results in a teaching moment. However, some plays don't seem to have a purpose (Waiting for Godot by Samuel Beckett is one example of a play deliberately devoid of purpose) and yet still remain popular choices for performance today.
As for the playwright having a "duty" to the audience, I'm not entirely sure that's accurate at all. And if he or she does indeed have a duty, I believe it would be to entertain, not to teach or please. Some of the best plays neither teach nor please, but still manage to entertain.