How long wait you need is different for different persons on different computers and different connections. When you share scripts with others you have to take care so that they work for people with high ping and frequent freezes. Also, the wait doesnt matter at all on deposit gold. It's when you're trading that it is important, it takes some extra time for the trade window to open after you say "trade" and if the trade window isnt open when you call the selling function it will see that you don't have any sellable items and walk away without selling anything. This is exactly what happened for Duuhduuh here, changing the wait to 5000ms is a bit overkill but increasing the wait time was the right move.