I'd probably use a variable. for example "hasgun"
On green flag, set "hasgun" to 0
Then, at the beginning of your shooting script, add
"If hasgun=1" as a condition that runs the shooting, as well as the key-press or mouseclick.
Then, on the gun sprite
If touching sprite "player"
hide
set hasgun to 1
Offline
It would look like
<when green flag clicked>
<set{ hasgun }to( 0
<forever>
<if><touching[ gun
<set{ hasgun }to( 1
<end>
<end>
Offline
<when green flag clicked>
<set{ hasgun }to( 0
<forever>
<if><touching[ gun
<set{ hasgun }to( 1
<end>
<end>
<when green flag clicked>
<forever>
<if><( <{ hasgun }> <=> 1 )>
<switch to costume[ gun
<else>
<switch to costume[ nogun
<end>
<end>
Offline
<when green flag clicked>
<set{ hasgun }to( 0
<forever>
<if><touching[ gun
<set{ hasgun }to( 1 )
<else>
<set{ hasgun }to( 0 )
<end>
<end>
<when green flag clicked>
<forever>
<if><( <{ hasgun }> <=> 1 )>
<switch to costume[ gun ]
<else>
<switch to costume[ nogun ]
<end>
<end>
correction
Offline