The parameter name should be “hardclip” not “Distortion.hardclip”.
Once you change this it should work.
You could also use the name of the effect as second argument of findEffects(). Otherwise if you change the order of effects or add some effects to Program Bus the Distortion might not be the first effect returned by findEffects().
effects = this.program:findEffects(true, "Distortion")
distEffect = effects
There are several ways how to do this. I would probably do something like this:
local distEffect = this.parent:getBus():getEffect("Distortion")
if distEffect then
Put everything inside the callback function. The if statement is there to guard against script errors. If it finds the effect it sets the parameter, if not then nothing happens.
On the other hand if you’re sure you won’t change the structure of the program tree (adding more effects or reorder them) the first option might be a bit more efficient. It doesn’t look for the effect each time you change the DIST_AMOUNT parameter. Only looks for the effect when the script is loaded.