Help me coding survivor upgrading not working

Godot Version

4.2.1

Question

I want to limit the number of weapons a player can have, but I can’t do it. Every time I level up and the options appear, I see more than I should.

code I tried but couldn’t get