You may need to press the flag multiple times to get the timing right. I swear I didn't code it like this
The original video is from The Duck