To ensure that the reason of failure is ufw please check its status with the command sudo ufw status. If ufw is active please show us ufw rules in effect.
If the purpose of your hotspot is to provide Internet access, then verify if routing is turned on and check routing table.