How to change variables from a script in another scene?

So basically the problem I’m having is this:
I’m making an FPS, and the script I have to pick up weapons uses the boolean “beingHeld”, its set to true in the inspector for the weapon which is being actually held. The problem is, I’m making a menu with the GUI in Unity and want specific weapons according to the GUI button that is pressed, to be beingHeld = true in the inspector, but since its another scene, I can’t access the game objects, I can access the script, but all the other weapons would be set to beingHeld = true, but I only want the specific weapon to be set to true in the inspector, if this button has been pressed. Anyone know how to do this?

Use a static class with static member for your inventory.

The static class is not destroyed at the end of a scene so its members are kept with their values.

You could also use an object with DontDestroyOnLoad.