Update script.js

Hopefully fixed out of bounds errors