[SOLVED] PC wont run, turns off seconds after starting up, rarely shuts down during gaming

Feb 24, 2019
1
0
10
So, heres my setup

Intel core i3 8100 3.6 GHz
Motherboard MSI H310M gaming plus
EVGA NVIDIA 1060 3GM SC
16GB RAM corsair

as said in the title, sometimes when i run my pc it just shuts down a couple of seconds after. it rarely happens but today it shutdown while gaming. i kept track of temperatures of cpu and gpu and it was looking good. any ideas whats causing this? is there any compatibility issues or is it my power supply dying?