Good advice from Glockshooter, check that important safety-related issue FIRST.
If that's not the problem, then your trouble is most likely in the fire control group, located in the pocket in the stock.
If your problem still persists after a good cleaning with mild solvent and compressed air, it's most likely the hammer/sear/disconnector interfaces that are your problem.
If you're ok with tools, remove pocket, disassemble, and inspect engagement surfaces. Replace any that are chipped, badly worn, etc., reassemble, and test-fire.
Also disassemble and clean the bolt/carrier group, inspecting for wear. Good luck!