the problem is that you remove the node with “queue_free()” and the sound is a child of the node and is therefore also removed. You can either put the sound to the gamemanager or reparent it before you delete the node. Just be careful that you also remove the soundplayer when you reparent it
Then, in your pickup.play() method, change it to a single line that calls Sound.play() and passes the audiostream you want to play. The sound will play and then the audiostream player will destroy itself. This allows multiple sound effects to play at once and overlap, as well as makes sure you don’t end up with a memory leak.
There is a law in programming that says that codes are executed one by one from top to bottom.
so , you just need to put the queue_freeon the bottom.
queue free removes nodes or data’s so when you remove the node , audio player gets remove too ! and there is no music file to play.
at first you should play the song , and then kill that !
queue_free() actually runs at the end of the current frame, regardless of where you put it in the code. I had the same assumption you did, and it took me a while to realize that this method works this way. Hence, the code above is a simplified version of my final solution to exactly this problem.