Issue with changing of brightness of screen with Function keys

[ I am using i3wm]
I earlier had the common problem as most have here. Function keys did not work for changing brightness.
But i worked on the issue. and fixed it.
What i did there was exactly as stated here:

But here is another issue with that. I have set brightness to change in steps of 5%.
But when i use function keys to change it. The change is random. like:
For the first key press. the brightness decreases from 100% to 89%

For 2nd keypress, changes from 89% to 79%

Then to 69% to 59 to 49 to 33 and so on… I mean the values are random…

and when i increase it, it again increases randomly. like from 33% to 44% to 54% to 64% like:

All i want to know why is the change so random? and why it doesnt change in steps of 5% as written in script

NOTE: I am using brightnessctl. and also when i directly use the brightnessctl via terminal, the change is consistent with the specified change percentage.

Could you post the script you’re using? It may have an issue (unlikely but still). Also are you sure some kind of service isn’t also trying to change the brightness when the function keys are pressed?