This error means it doesnt have the permission (sudo) to change something.
Simply drag the "run with sudo" block at the beginning of your script, and voila! Fixed!