The deaths of the children at the hands of William Afton played a crucial role in driving the plot and setting the eerie atmosphere of the Five Nights at Freddy's franchise.