24 Therefore, whoso heareth these sayings of mine and doeth them, I will liken him unto a wise man, who built his house upon a rock–
25 And the rain descended, and the floods came, and the winds blew, and beat upon that house; and it fell not, for it was founded upon a rock.
26 And every one that heareth these sayings of mine and doeth them not shall be likened unto a foolish man, who built his house upon the sand–
27 And the rain descended, and the floods came, and the winds blew, and beat upon that house; and it fell, and great was the fall of it.
(3 Nephi 14:24-27)
We need to live our lives according to eternal principles if are going to have sustainable happiness. The commandments teach us how to make decisions which are wise over infinite time horizons. Decisions which involve breaking the commandments may appear to bring blessings in the short run, but those blessings are ephemeral and fragile. The man who built his house upon the sand may have had some fantastic beach parties while the weather was good!