The headphone jack is the likely issue. Within it is a set of switches which when closed sends the output to the speakers. See if a set of headphones work when the speakers don’t then you know the switches are messed up in the socket. Sometimes it only takes a bit of cleaning other times the contacts get messed up.
Sadly, the socket is part of the logic board and is a custom part so unless you have access to a junker with a good socket you’ll want a wired external or Bluetooth speaker set as being the cheapest way to solve this.