How can I run a script I made on my mac automatically.
It needs to run once a day. Because it requires rsync the mac needs to be connected to the internet and I have realised when it is sleeping wifi isn't connected.
How can I get around this?
You can use automator to create a plugin and have iCal run it as an alarm action. Schedule the alarm to run daily
See this answer for the "how to run daily" part of your question: How can I get a script to run every day on Mac OS X?
Because of how launchd works, it will run the command on wake if the scheduled time passed while your computer was asleep.