How can I change the brightness with a slider?

It still doesn’t work for some reason? And this is what the slider looks like: