extends Node var Bus = { Master = "Master", Ambiants = "Ambiants", Sounds = "Sounds", Music = "Music" } func play_sound(sound: AudioStreamSample, bus: String, parent: Spatial = null): if parent: var stream = AudioStreamPlayer3D.new() stream.transform = parent.transform parent.add_child(stream) stream.unit_size = 100 stream.bus = bus stream.stream = sound stream.play() stream.connect("finished", stream, "queue_free") else: var stream = AudioStreamPlayer.new() stream.bus = bus stream.stream = sound stream.play() stream.connect("finished", stream, "queue_free")