It depends on the $PATH$PATH variable of the user you are currently logged in. If the script is on more than one directories the first found is used, in this case $PATH$PATH of root should be something like
PATH="/usr/bin:/bin:...
PATH="/usr/bin:/bin:...
and for the user it should be something like
PATH="/bin...
PATH="/bin...