how to determine the change in the number of moles of gas in the reaction 2H2 g + O2 g= 2H2Ol i thought it was 2 because the product is a liquid but that isn't correct

Don't you have 2 moles H2 + 1 mole O2 on the left to make 3 moles on the left? If H2O on the right is a liquid, then,

0 moles on right - 3 moles on left = -3 mols for delta n.