One way to achieve this is using a Timer, which you could add as a node in the editor, or via code.
- Add a new timer node to your player, and set the wait time to however long you want it to be between shots – say, 0.1 seconds.
- Also set the timer to "One Shot"
- In your code, when you check whether the user is firing (presumably to call your shoot method), also check that the timer is stopped. This will prevent multiple shots being fired while the timer is running.
- Finally, at the end of your shoot method, start the timer so that another shot can't be fired straight away.
Your code may end up looking something like tihs:
if Input.is_action_pressed("fire") and $CooldownTimer.is_stopped():
# your existing code
I also recorded a video of this setup and posted it here, in case it's useful! https://www.youtube.com/watch?v=85A7OaAkAxg