I am surprised that you cannot see it yourself.
You are trying to make a solution in Flexible, but you cannot find a simple way. Then you suggest "scripts". Whenever someone just mindlessly suggest to use scripts for everything, I cringe.
Any interlocking shouldnt be dependant on the HMI.
Here is what you should do:
Use a "setbit" funcation on the HMI button.
In the PLC, evaluate the bit via a oneshot. If the oneshot fires, set an impulse bit and reset the HMI bit.
Evaluate the impulse bit in the PLC program and perform the toggling of the output bit, but interlock it with whichever conditions that should disallow the button function to activate.
That is the bare minimum.
If you want to add eye-candy, you can change for example the foreground color of the button to grey, when the interlocks are blocking the button function.