During rehearsals for his new Off Broadway play, “Storefront Church,” John Patrick Shanley rewrote the final scene 20 times before he was satisfied. But it wasn’t until the production’s first preview, on May 16, that he discovered other scenes needed revising too. The evidence came from audiences — the sort of patrons who pay to attend Off Broadway shows early on and have more power than they may realize to shape new plays, even one by a Pulitzer Prize winner like Mr. Shanley (“Doubt”).

Some of these theatergoers fidgeted restlessly during a scene in “Storefront Church,” at Atlantic Theater Company, catching Mr. Shanley’s eye as he sat nearby. A couple of jokes fell flat. And a key moment for one character, Mr. Shanley realized, was undercut by a bit of dialogue — “You’re kidding me” — that landed with a thud. So he spiced up the line: “Is this one of those reality shows? Cuz I’ll kill ya both.”

Mr. Shanley, who is also the play’s director, and who has until shortly before opening night next Monday to finish making changes, said: “Preview performances are like trench warfare. You troubleshoot scene by scene based on your read of the audiences. They know when something isn’t working. You respect them or you’re dead.”

While regional American theaters hold a few nights of previews before the official opening, mostly for the actors to adjust to a live audience, and many London shows have just a week of previews, New York theater producers and directors treat them as a serious — and multiweek — creative period. Most Broadway shows have three weeks of these trial runs, when actors hone their performances or — for problem shows like the recent “Leap of Faith” — script and staging overhauls are made. Critics come toward the end of previews, and their reviews are published after opening night. Shows then run for weeks or months, or sometimes just days for flops.