DNS exchange script

Hi!
First of all i want to change a server address to an another one, but i don’t know how to start it. This is my first time to use script in any mikrotik devices, so probably I’m a newbie :smiley: .
I have addresses in dnsServer like 8.8.8.8 and 4.4.4.4, just for the example, and i want to put the 10.10.10.10 to next to them, but maybe i did something wrong , becouse it isn’t working

system script set test source={
:local dnsServer [/ip dns get servers]; 
:local append 10.10.10.10; 
:local newdns [:put ("$dnsServer" , "$append ")]; 
/ip dns set servers=$newdns ;}

if i run the script it got this message:
8.8.8.8;4.4.4.4;10.10.10.10
invalid value for argument server:
invalid value for argument ip
invalid value for argument ipv6

Sorry for my English!!!

Oh i solved this error… I wrote spaces…
So if anyone have an idea to change 8.8.8.8 to 10.10.10.10 please tell me :slight_smile:

:smiley: If someone got a problem like this, i describe what i got.

system script set test source={
:local dnsServer [/ip dns get servers];
:toarray $dnsServer ;
:set name=($dnsServer->[:find in=$dnsServer key=8.8.8.8]) value=6.6.6.6; 
/ip dns set servers=$dnsServer;