Volume Buttons not working Sound is working perfectly but if I press the volume buttons on my touch-bar it won't work. Even the slider on my screen also won't work.

Only the volume slider on the touch-bar will work.
Reset NVRAM or PRAM on your Mac

NVRAM (nonvolatile random-access memory) is a small amount of memory that your Mac uses to store certain settings and access them quickly. PRAM (Parameter RAM) stores similar information, and the steps for resetting NVRAM and PRAM are the same.

Settings that can be stored in NVRAM include sound volume, display resolution, startup disk selection, time zone, and recent kernel panic information. The settings stored in NVRAM depend on your Mac and the devices that you're using with your Mac.

If you experience issues related to these settings or others, resetting NVRAM might help.

How to reset NVRAM:

Shut down your Mac, then turn it on and immediately press and hold these four keys together: Option, Command,P, and R. You can release the keys after about 20 seconds, during which your Mac might appear to restart.

More detail from the Offical Apple Support page