Sounds like a school assignment? Or just a creative problem you're facing. Do some research into putting particles on a surface, and it's not too difficult to have these on vertices and then instance your object using the particles. Don't even need a script. Hope that gets you in the right direction.