I have to advice you to find and use a Made-ready script instead of creating a new one if you have little or no knowledge on scripting.
My apology if you know lot of it, and my apology if you feel insulted.
Anyways, it advisable to find one, like what I've suggested which is created by John, here's the
script