the explanation is in the previous post
they check their behaviour in a hope they will be rewarded in the afterlife.
If they thought there was no afterlife they would have no consequences and a person without fear of consequence is very dangerous indeed.
Plato teaches us that we should be good in life, to reap the benefits in life.
He argued that if we are virtuas : striving for wisdom, courage, moderation and justice and balance in life, while being ruled by logic and not desire, we will be happy. Lack of these these traits (virtue) will mean that we are unbalanced and our mind and body will not be in sync. The body mustn't rule the mind or our logic would be under the control of short term desire and wants, if logic rules our lives in balance with the other virtues of wisdom, courage and restraint, then we will be happy.
It should be noted that the writers of the New Testament would have been educated in Greek philosophy and were familiar with Plato and other Greek philosophers.