0 votes

im triying to make a shootsound, but if i press the shootbutton one time, the sound gets played infinitly. im using this code:

func process(delta):
if Input.is
actionjustpressed("shoot"):
$AudioStreamPlayer.play()

pass

what do i have to add to the script?

Godot version 3.3
in Engine by (213 points)

2 Answers

0 votes

Make sure your audio file is not set to be looped.

Select your audio file in the FileSystem dock. Then click on the Import tab (to the right-side of the Scene tab by default). Scroll down and make sure the "Loop" checkbox is not checked. Don't forget to click on "Reimport" if you changed anything.

by (176 points)
0 votes

thanks, it works. :)

by (213 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.