but there are rules and regulations (thou shalt not...)
and if we do them in hopes we will get to heaven because we do them, it is called legalism
This is the mentality that eventually leads to lawbreaking and sin. Here's first "thou shalt not" - "Of every tree of the garden you may freely eat; but of the tree of the knowledge of good and evil
you shall not eat, for in the day that you eat of it you shall surely die." Is that rule and regulation? Or a kind and fair warning? The serpent reframed it into a rule and regulation, which made Eve feel like God was being restrictive, God was withholding what was rightly hers from her, the seed was planted in her mind and it eventually led her to the Fall, and that was how the promise of salvation was necessitated in the first place - to save humanity from the Fall, which was the consequence of breaking the "rule". Call that legalism if you want, it is crystal clear that law abiding may not lead to salvation, law breaking certainly leads to destruction.
Actually you missed the point.
The person said he obeyed. Jesus came back at him to prove he did not obey. he was not perfect according to the law.
the person went away sad because he loved money more than God (he did not keep the first command)
if the person repented and said he could not do it. I am sure Jesus would have saved him by showing him it is not obedience to the law that saved. and no one has kept the law and given him the chance to repent
Jesus didn't ask about the first commandment, he asked about commandments six to nine, which the rich young ruler had duly obeyed since his youth, and Jesus didn't bust him on that. It is you who missed the point that keeping these commandments is NOT "legalism".
What you don't understand is that obedience and disobedience are tied to BLESSINGS and CURSES, not salvation and damnation. Work determines your REWARD, not your salvific status.
Now it shall come to pass,
if you diligently obey the voice of the Lord your God, to observe carefully all His commandments which I command you today, that the Lord your God will set you high above all nations of the earth. And
all these blessings shall come upon you and overtake you, because you obey the voice of the Lord your God. (Deut. 28:1-2)
But it shall come to pass,
if you do not obey the voice of the Lord your God, to observe carefully all His commandments and His statutes which I command you today, that
all these curses will come upon you and overtake you. (Deut. 28:15)
If anyone’s work which he has built on
it endures, he
will receive a reward. If anyone’s work is burned,
he will suffer loss; but he himself will be saved, yet so as through fire. (1 Cor. 3:14-15)