Hello, I'm currently creating an rpg and I've ran into an issue creating a dialog box system. Here's a few screenshots of the code and what I'm trying to do.



What I'm basically trying to do is have a sound affect play as the characters are typed out in the dialog box, but I'm having a hard time getting this sound to play, if anyone could help me I'd really appreciate it.

  • There's a second mistake. That script is attached to the node Text. AudioStreamPlayer2D is a sibling of Text, not a child.

    One way of dealing with that is to use:
    $"../AudioStreamPlayer2D".play().

    Another solution would be to move AudioStreamPlayer2D so that it's a child of Text.

DaveTheCoder

I've tried that, but I got these error messages that said the AudioStreamPlayer2d node wasn't found.

The default name for the node is AudioStreamPlayer2D, not AudioStreamPlayer2d.

The same error appeared when I corrected the AudioStreamPlayers name.

There's a second mistake. That script is attached to the node Text. AudioStreamPlayer2D is a sibling of Text, not a child.

One way of dealing with that is to use:
$"../AudioStreamPlayer2D".play().

Another solution would be to move AudioStreamPlayer2D so that it's a child of Text.