Obtaining the four Scrolls
The 1st Scroll
Go to the potion lab and put stuff in to the pot to play the minigame. Use it on the one kid in the potion lab, then the one in the hall to receive the scroll.
The 2nd Scroll
Go the classroom and see the sleeping girl. Then, go to the dorms and get the alarm clock from under the shaking box by "move" spell on the top one, and "levitate" on the bottom one. Grab the alarm clock, then go back to the girl and click her.
The 3rd Scroll
Go to the clock right outside the forbidden library and use the "undo" magic spell on the clock.
The 4th Scroll
Go up to the dorms and tap the kid, then tap the first torch. Choose the right spell (Torchius Lightus) and do the same to the other torch on the other side of the room. Then go back to the book case in the dorm and tap the flying book to play a minigame and win the key. Open the chest and give the hat to the kid.