Search code examples
godotgdscript

godot sound won't play in script


So in my coin script, I game it plays a file called coin.wav but I cannot hear it play

Code:

extends Area2D

signal coin_collected

func _on_coin_body_entered(_body):
    emit_signal("coin_collected")
    set_collision_mask_bit(0, false)
    print("collected")
    $coin_sound.play()
    print("stared sound")
    queue_free()

Scene: enter image description here

Note: if t turn on autoplay it will play the sound so I know its not the file


Solution

  • alright it was because I was doing queue_free() before the track could play