Weapon Swapping?

‘You can also check in the Add Equipped Weapon event that the length is less than some number to limit how much you can have in your inventory’

I’ve been trying to limit my array so that i can only pick up so many guns but at the moment the number is infinite almost.

How do i limit the amount i can hold?