Disabling weapons

Is it possible to code it so that when certain actions happen, one of the hero’s weapons is disabled?

Disallow/Set Prim/Secondary Enabled False. Disallow allows the function to happen, but blocks the input, though you can still check if the button is held. The set enabled uses a Boolean of if it is enabled, like a permanent hack on a/few certain things, or disabling certain things in custom games.

That only disables the fire. I want to disable weapons using codes, for example mercy’s pistol.
Edit : I found out how to do it

Ooohl can you share your way? Id love to know how to do thay

Its in custom game hero settings, not workshop.