How To Litter Box Train A 3 Month Old Kitten?

How to litter box train a 3 month old kitten?

I have an 8 week old male kitten who is very active and playful. I am having trouble breaking him of the habit of spraying in his litter box and my house. He only does it in the morning and sometimes at night. I do not know what else to do or how else to train him out of this behavior!