Israel had that problem in Joshua 7. God have given them clear instructions that they were not to keep anything for themselves after conquering Jericho (Joshua 6:18-19). But, a man named Achan disobeyed and took some things (Joshua 7:1).
Achan's sin resulted in Israel's defeat at Ai (the next battle). 3,000 men of Israel fled; 36 were killed (Joshua 7:4-5). Achan probably thought his sin was private. No one would know; no one would get hurt. Sin is never private. It always impacts others - our family, our friends, our church, even God's reputation. Achan's sin cost 36 people their lives!
Disobedience carries a high cost, but God is extremely merciful. After revealing Achan's sin, God instructed Joshua how to defeat Ai. Joshua followed the instructions carefully and easily defeated the city. The Bible seems to indicate that not a single Israelite died in the battle (Joshua 8:25).
What a difference obedience makes. So, as you consider God's commands remember Ai -- choose obedience, choose life.