Here’s a little shell script to allow you to run the script as root without having to manually sudo it or set the setuid flag on the file. The script will prompt for your password and the running will user will need to be in the sudoers list (basically any Mac OS X admin user). Make sure the file is executable too.
#!/bin/sh
if [ $USER = 'root' ]; then
echo 'I am root! Put your root script here!'
else
osascript -e "do shell script \"$0\" administrator privileges true altering line endings false"
fi