How to play sound just once

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

I wanted to make a sound by pressing a button so I attached a script to main scene and connected the button to it. And typed like this

func _on_TextureButton_pressed():
$AudioStreamPlayer2D.play()

Although I could hear when I pressed the button, the sounds are repeated again and again even if I pressed the button just once. Is there any way to stop it from repeating???

:bust_in_silhouette: Reply From: khaylaaaa

Did you accidently loop the audio by any chance?

Yes I just found out that was the problem
Thank you for helping me.

Radgrid728 | 2022-12-06 23:44