Closed-cell foam blocks vapor. Closed-cell spray foam cures into a dense, rigid material that acts as a Class II vapor retarder. Humid Gulf Coast air cannot pass through it, so there is no cold surface inside the assembly for condensation to form on.
An unvented attic is the point. Foaming the roof deck removes the attic from outside air entirely. The space stays close to your living temperature year-round, which eliminates the temperature differential that causes condensation in traditional vented attics.
Open-cell foam is a different story. Open-cell foam is vapor-permeable. In a hot-humid climate like Southwest Louisiana, open-cell applied to the roof deck without a proper vapor retarder can allow moisture to migrate to the roof sheathing. Closed-cell does not carry that risk.
Thickness is not optional. For closed-cell to function as a vapor retarder, it needs to be at least two inches thick. Installations that go thin to cut cost can leave the sheathing exposed to condensation risk. Spec the depth correctly and this is not a concern.
Dry surfaces before the gun goes on. Foam applied to wet or damp wood seals existing moisture in place. The attic needs to be dry and the home conditioned before any spray work begins. A reputable installer checks wood moisture content first.
Fix the source, then seal. Spray foam does not cure a roof leak, a condensate overflow, or an AC system oversized for the house. If the moisture has a source, address it first. Foam over an active problem holds the problem in.