So, I am making a recreation of TranZit in minecraft for cod zombies, and I'm tyring to make a system that only allows the player to have two weapons. I had a system in place but it wasn't really going to work, and would cause to much lag. This video kind of shows what was going to try and do.
How can I improve this to make it to where it detects when you only have 1 or two weapons and if you have 2 it will not allow you do but the weapon, but if you have 1 it will allow you to but it. Also, how would it detect when i don't want a weapon anymore.