Yes, it is loosely based on a true story. The idea was inspired by real - life rumors and urban legends about haunted animatronics in family - friendly restaurants.
Well, Five Nights at Freddy's has some elements of a true story. There were actual reports of strange occurrences in certain restaurants with animatronic characters. However, the game has greatly exaggerated and fictionalized these ideas. It took the basic concept of spooky things happening around animatronics and turned it into a horror - filled gaming experience.