Bad Kids Go to Hell

A SWAT team barges into a school library to find a student holding an axe and surrounded by savaged bodies, before the film goes back eight hours previously. Six unruly prep school students are forced to serve Saturday detention for eight hours at Crestview Academy, where psychologist Dr. Day (Jeffrey Schmidt) conducts psychological testing on the students to examine their personalities and trigger their demeanors, recording each session in the process. Despite receiving an expulsion notice from Headmaster Nash (Judd Nelson), a new low-income student Matt Clark (Cameron Deane Stewart) plans to compensate for his poor behavior by joining the awkward Tarek Ahmed (Marc Donato), the jock Craig Cook (Roger Edwards), the sly Goth girl Veronica Harmon (Augie Duke), the prissy and asthmatic Megan McDurst (Amanda Alch), and the popular girl Tricia Wilkes (Ali Faulkner) in detention.
After giving them the task to complete a school history assignment, Dr. Day restricts their internet reach and takes away many of their phones, leaving the students imprisoned alone in the library, remodeled by the janitor, Max (Ben Browder), with Native American portraits and an Apache statue. The students believe the library is haunted. They realize they have mutually dysfunctional family lives, though they have their differences with each other, sparked from prior encounters which have been recorded on camera. They all try to break out of the library, but they are sealed in. Behaving mischievous, Veronica hides Megans inhaler and frames Tarek, leading to Megan having a shortness of breath and dying before its found.
Getting the internet to work, Veronica does her research. They discover an old, deceased Indian, Jacob Rainwater, once owned land that was stolen from the Apache tribe in the 1870s by a General, Andrew Winston Clarke, before it was taken over by the city of Crestview to build the school. As the students argue on-and-off, they find a vent to navigate to different rooms that have its doors locked on both sides. Thereby, they learn Matt has an undisclosed criminal background and become suspicious of him. After Tarek goes missing and they return to the library through the vent, they discover Tricias powerful mother is the Governor, Craigs father is the city councilman, and Megan's father co-owns the property of which Tareks father is responsible for building the library, all of who made an agreement with the school to ensure their spoiled kids would be guaranteed to graduate in exchange for the construction of the library.
A dark storm rages on outside the school, tampering with the lights and electronics inside, increasing the students fear of the paranormal. In an accident, Craig falls down the steps in the library and is mysteriously staked by one of his crutches, dying instantly. Not long after, Tricia admits her mother was the reason why Jacob lost his house, and Veronica secures evidence on Craigs camera showing that Tricia, Craig, Megan and Tarek had killed Jacob at his home to vacate the ownership of the property, leaving no next of kin to take over. Deeply believing in ghosts, they attempt to contact Jacobs spirit so that Tricia can call a truce, but the spirit rebels and seemingly harms Veronica. The spirit then appears, and she uses a nail gun to commit suicide due to fright.
Shortly after, Dr. Day emerges to reveal his alliance with Veronica. The whole time, they masterminded everyone's paranormal delusions and emotional outbursts, triggered by psychological tests (inkblots), all to sell the story and make money. Killed by Dr. Day for trying to escape through the vent, Tarek's dead body is what was used as the ghost. Before Veronica can shoot Matt using the nail gun, Dr. Day abruptly kills her with an axe for poisoning him and causing his diarrhea earlier. Matt is framed for all the murders, as an unexpected booby trap involving the statue severs Dr. Day's head, killing him. A SWAT team barges in to find Matt armed with an axe in the middle of the carnage. Matt is subdued and placed in a straitjacket. Max arrives, revealing his Apache ancestor, Jacob Rainwater, owned the house where the school now stands, which at one time was also taken by General Clark and his army over a century ago. In the closing credits, Matt is driven away in an ambulance and Tricia's Governor mother, Tareks father and Craigs father pay off Max in order to clear them of any involvement in the incident.

Question: Why are the students in the library?
Answer: to complete a history assignment