k, I made my hat NPC, no one helped me

But I have it so when you pick up the NPC it sets an array.It uses client.hats for the variable.
question:
why is it when I make a variable like client.hats[0]=1; it only stays true for that level, and goes false for any other level?