To remain loyal to God when you are by yourself, you must develop your “perceptive powers... to distinguish both right and wrong ” and then train those powers“ through use ” by acting on what you know is right.
لِأَنَّهُ حَافَظَ عَلَى وَلَائِهِ لِلهِ أَمَامَ ٱلنَّاسِ وَكَذلِكَ حِينَ كَانَ بِمُفْرَدِهِ .‏ —‏ اِقْرَأْ دانيال ٦ :‏ ١٠‏ .‏