Need some help figuring out my code

Wow, i completely missed that. And you're right I should just do all of that in a function. I'll change it tomorrow