There are two different games :
In the first game, I find the hat and repeatedly press the E key, but I can't pick it up, and someone else takes it instead.
In the second game, I found the hat and pressed E several times, but it still didn't work. The magician destroyed it in front of me.
Knowing that between the two games, I found it and was able to pick it up this time.