It really helps to know the exact model of the Mac and version of macOS being used. You can get this information by clicking the Apple menu and selecting "About This Mac".
Do you have any third party audio software installed?
Make sure no headphones or external speakers are connected since they will disable the internal speakers.
Try booting into Safe Mode to see if you can get sound from the speakers.
Can you get sound from headphones or external speakers?
Try running the Apple Diagnostics to see if any hardware issues are detected....sometimes it includes an audio test.
If this is an Intel Mac, then try an SMC Reset and PRAM Reset (hold the PRAM Reset for at least two chimes).