problem to change ip route distance with script

Hello mikrotikers,

I am having troubles to change the distance in the routes with scripting, i can’t find the way to do it, maybe you guys could give me a hint

This is the code that I’m trying to use but can’t change it automatically to 2

:if ([/ping 8.8.8.8 count=5] = 5) do={
        /ip route edit number =1 value-name=distance 
}

And I’m kind of stucked in here…any answer to this??

Thanks for your help

nevermind…i was using the wrong sintax…instead of edit it’s set

/ip route set distance=2 number=1

thanks anyway