Who Invented the First Gun?

The exact person who invented the first gun has long been lost in history. It is known that guns started to appear in Egypt in the mid 1200’s. This is the earliest that they were seen in battle.