Allow arrays in script text

I wanted to make this part more efficient and less copypasta but I think I just ended up obfuscating it...