I have code for an input press but I only want to be able to press it once and then not run it when I press it again

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RaGeSalty

So i have code for summoning some enemies in and its for an input button and i don’t want them to spawn in when I press the button again.

:bust_in_silhouette: Reply From: godot_dev_

You could create a flag that is initially false, and when the player attempts to spawn an enemy, the enemy is only created when the flag is false. After successfully creating an enemy, set the flag to true to disable enemy creation.