In saying this, Jesus was telling him he had failed to give priority to the foundational truth upon which stand the two greatest Commandments: love! He needed to focus upon loving God and others instead of only himself. The first, and greatest Commandment says, "Thou shalt love the Lord thy God with all thy heart, and with all thy soul, and with all thy mind" (Mt. 22:37). Only when one loves God, will he be motivated to fulfill the second, "Thou shalt love thy neighbour as thyself" (Mt. 22:39). That is why the Apostle Paul could say, "For all the law is fulfilled in one word, even in this; Thou shalt love thy neighbour as thyself" (Gal. 5:14).
Recently, I have been reading many comments on Facebook, which express concern that too much of the Church's focus is upon God's loving nature, while neglecting to teach that God is also going to judge those who reject Jesus, and sentence them to an eternity in the Lake of Fire (Rev.19:20; 20:10-15). Preaching, in my opinion, should focus upon God's demand for holiness, man's inability to be holy, in and of themselves, and the provision for fallen man that comes by trusting in Jesus. He took our sins, and He has provided us with the gift of His holiness (2 Cor. 5:21). Trusting in Jesus results in our being indwelt by the Holy Spirit, who then enables us to love our neighbor.
If you want to love others, you have to allow God's Spirit to lead you.