Originally I had my code yielding until the sound finished.
func _on_optsbut_pressed():
if global.sfx == true:
$Sfx/Select.play(0.0)
if $Sfx/Select.playing == true:
yield($Sfx/Select, "finished")
get_tree().change_scene("res://states/options.tscn")
But that causes a slight delay between the button push and the execution. I was told that a call_deferred might work better. I have this now:
func _on_optsbut_pressed():
if global.sfx == true:
$Sfx/Select.play(0.0)
call_deferred("finished", get_tree().change_scene("res://states/options.tscn"))
But this jumps over the sound and goes straight to the options menu. Any help would be appreciated. Thank you.