Welcome to the forums @Streetslab!
I think the set_stream
function expects an AudioStream object as the passed-in argument. This means that you will not be able to pass a string to it as the input.
Instead, you'll need to load the AudioStream, and then pass that to it. For example, if name
is the name of the audio file you want to load:
var audio_path = "res://Sounds/500_" + str(name) + ".ogg"
var audio_stream = load(audio_path)
# setting stream directly is the same as calling set_stream, because
# set_stream is the setter function for the property.
$AudioStreamPlayer.stream = audio_stream
$AudioStreamPlayer.play(0)
In the sample code you provided in your post, I am not sure what snd
is for, so I didn't incorporate it into the above example.
Hopefully this helps a bit!