Thanks for the quick respose. I will consider buying a better cooler than the stock one. Also the CPU isn't overclocked and it still has some heat problems but I think a new cooler might solve this issue.
I have this problem where my CPU is overheating when I am playing certain games and sometimes the computer juist goes off when the temperatures go too high. My CPU is I7 7700k and I am using a stock intel cooler.