Making a camera animation play when texture button pressed

Tree:
Game
Main menu
Camera
Camera animation

The main menu has a texture button in it
How do I make it so when that button is pressed the camera animation plays

You add an export variable to your menu script

@export var camera : Camera2D

Then you assign it in your game scene.

Then on your _on_button_pressed do that animation with your camera.

I don’t know what that “Camera animation” object is, is it an AnimationPlayer?
Of so, you could reference that instead of the camera.

@export var camera_animation: AnimationPlayer

I wrote this and got “@export” is not allowed in this level.

You need to define them on the top section of your script, outside the functions.
The documentation has some code examples.

I tried dropping them in the script but all i got was “can’t drop nodes because script ‘TextureButton.gd(*)’ does not inherit the nodes’”