Godot 4.3
I have been working on a project and I decided to load some audio in for the main menu sounds when a button is pressed. But it doesn’t seem to recognize “play()” or “amp” somehow (even though the variable is AMP). How can i make audio play when the button is pressed?
CODE:
extends Button
@onready var audio : AudioStreamPlayer = $AudioStreamPlayer
@onready var amp = get_node(“AudioStreamPlayer”)
func _on_pressed():
get_tree().change_scene_to_file(“res://scenes/menu screens/screens/game_modes.tscn”)
amp.play(“buttonpress”)
If anyone could help me with this issue it would be greatly appreciated.