The Buddha taught people to be aware that all forms of worldly happiness are impermanent.
People should not be attached to (or distracted by) these temporary pleasures, otherwise they suffer when these are gone.
The truths of suffering must first be recognized before the solution to the end of suffering can be found.