question about script controller

as shown in attatchment.
i want to use float script controller to control z rotation angel of $bone11.
so i put a silder named silder01,and write code for $bone11
.rotation.controller.z_rotaion like this:

local oldagl
if oldagl==undefined then oldagl=$Slider01.value
if (distance $point02 $bone08)>=41.7819 then oldagl else $Slider01.value
oldagl=$Slider01.value

but it doesn't work,how to fix this problem?
thanks!

AttachmentSize
ggg02.max248 KB
Wu_Biao_Ti_.JPG43.35 KB