Why does my s4 restart constantly after facrory reset

A

AC Question

I bought the phone from a friend and factory reset it right away. When I turn it on, it's starts setup but after about 15 seconds(sometimes not even that long), it restarts. I'm unsure if it was doing the same thing to the person I got it from or if it was the factory reset. I've tried safe mode and just about every other option.