Why is it when I hold down a button to perform a action in my games it "spams" the action for as long as I hold the button?

id: 751570

category: Help with Scripts

posts: 3

Fa737 Fa737 loading
I'm making a shooter type game and when I press SPACE to shoot it spams bullets. How do I make it so when I press the button to shoot it shoots once?
Heres the link to my game: https://scratch.mit.edu/projects/967818050/
Please don't post the same question twice. Instead, you can “bump” your thread once a day (post anything, usually the word bump to bring it to the top of the forum pages). Only do this once a day, or it could be considered spamming.

Anyways, I answered your question on your other thread with the same question:
https://scratch.mit.edu/discuss/post/7895239/
-HamSlider- -HamSlider- loading
Try this

when green flag clicked
forever
if <mouse down?> then
play sound [ v]
wait until <not <mouse down?>>
end
end

Btw the sound is representing the shooting