1. the return value is how long the script waits between the loops, so every time your script loops its going to wait for 5-10sec based on your code.
2. You have no sleeps at all in your script so it will try to do everything as soon as possible but it takes a minimum of 1tick (0.6s) before anything changes ingame for most things, so your 2nd if statement is simply going to be false on the first loop
read this, especially the sleep part