"Restore unto me the joy of thy salvation; and uphold me with thy free spirit" - Psalms 51:12 KJV.
It was a prayer of forgiveness from the Psalmist to God. Something may have propelled the Psalmist to turn to God for restoration.
Salvation is in the Lord Christ Jesus. His death on the cross brought salvation to the world and joy to believers.
The joy could be seen in forgiveness of sins, healing, deliverance, redemption, oneness, love, peace etc.
From your position, you might be far from Christ's package salvation. Stop thinking that way! For God still cares for you.
You don't have to destroy or kill yourself because of a flaw or mistake. Forget that and enjoy the salvation of Christ Jesus.
In doing so seek for God's strength continually to overcome every manner of temptation.
No matter your flaw or mistake be yourself and go before God for forgiveness but don't kill yourself.
Renew your mind and let the word of God guide you in all things.
God still loves you.
O Lord, restore to me the joy of your salvation now and ever in Jesus' name, Amen.