i need help with my weapon stats

I have coded an inventory for the weapons that I am going to put into the game and it displays it on a bar to show what weapon I have and I can remove it and pick it back up. but I want to be able to make the weapon change the stats of the character such as damage, range, and attack rate when its in the inventory and when it is removed from the inventory those stats are removed and the damage, range and rate are back to 0. the iron sword stats code is on the weapon icon which is on the UI inventory.

As I understand – You want to store new values of your variables. If so, read aboud ScriptableObject. These objects allows to save new data even when you exit the game.