You're trying to access the array before you check to see if you are at the end of the file. Try this (not tested)
Code:
If NOT Open(1,"\\spghmbrsrv02\soft$\UID.txt")
If NOT Open(2,"\\spghmbrsrv02\soft$\UIDFail.txt",5) ;1 for Create file and 4 for open in write mode = 5
$UID=Split(ReadLine(1),"~")
While @error = 0
$USERNAME=$UID[0] ;6-1-1 UID
$USRNAME=$UID[1] ;3-4 UID
Color w+/n
?" Moving files from "Color y+/n"$USERNAME "Color w+/n"to "Color y+/n"$USRNAME"
?" "
;Move "\\spghmbrsrv01\private$\$USERNAME" "\\spghmbrsrv01\private$\$USRNAME" /h/s
If @ERROR > 0
Color r+/n
?"Failed!"
WriteLine (2,$UID+Chr(13)+Chr(10)) ;writes the failed pc to the pcfaillist.txt
Else
Color g+/n
?"Done!"
EndIf
$UID=Split(ReadLine(1),"~")
Loop
$=Close(1)
$=Close(2)
EndIf
Endif
Also, have you come across any that have failed yet, because this line doesn't look like it will work since you're trying to write an array instead of a string.
Code:
WriteLine (2,$UID+Chr(13)+Chr(10)) ;writes the failed pc to the pcfaillist.txt