Oscillations in sunspots have been extensively studied for several decades. Most of the research conducted about sunspot oscillations has focussed around variations in Doppler velocities and intensities. Fewer observational studies have focused on variations of the magnetic field in the photosphere, reporting contradicting results. Recently, variations in the magnetic field strength up to ∼200 G associated with running penumbral waves (RPWs) in the chromosphere have been reported. In this study, we analyze variations in the magnetic field associated with umbral flashes (UFs) and RPWs. We use spectropolarimetric observations recorded with CRisp Imaging SpectroPolarimeter (CRISP) mounted at Swedish 1-m Solar Telescope (SST). We have obtained the photospheric and chromospheric magnetic field of a sunspot by performing inversions of the Fe I 6301.5 & 6302.5 Å and the Ca II 8542 Å spectral lines, respectively, with the non-LTE inversion code NICOLE. Our results do not show any significant variations in the magnetic field strength in the photosphere. At chromospheric layers, UFs indicate peak-to-peak variation of ∼275 G, whereas in RPWs variations inthe amplitude of the magnetic field strength are reduced to ∼100 G. Variations in the magnetic field in UFs and RPWs are correlated to the variations in the temperature. In the past, many authors have suggested that observed temporal variation in the photospheric magnetic field of sunspots could be an effect of changing opacity due to oscillations in thermodynamical parameters. We analyzed changes in the geometrical height scale of inferred magnetic field due to oscillations in the thermodynamical parameters. Our results suggest that the observed variations in the umbral and penumbral chromospheric magnetic field can not be explained only by opacity changes caused by these propagating shocks. Hence, we conclude that the observed magnetic field variations associated with UFs and RPWs are intrinsic in nature.