Gun firing when not equipped

im having a simple issue, tho im struggling to solve it, in my top down game, ive assigned a key to fire a bullet, however, when you press the key, it fires the gun even though the player does not have the gun,

i want something like when he has the gun and the fire key is press for the gun to fire and only fire when the player has it, not sure what do add in my condition,

You could use a boolean object variable. When the gun is not equipped the variable is false. When the player picks the gun up the variable is toggled to true and if the variable is true you can fire the gun.

1 Like

To be honest I dont understand boolean variables, so could u maybe, possibly type it out or show it

This is my attempt (It don’t work XD) based on what you said, like i said i dont understand it, unfortunately.

Alright, here is an example:

At the beginning of the scene the object variable ‘fire’ of the gun-object is set to false. When the player collides with the gun the variable is toggled to true and this state is one of the conditions (together with mouse left click) to fire the gun. If the player drops the gun and it is in your level you need to toggle the variable back to false.

thank you, ill look into booleans, as it now feels they are a must to know