My animation plays before triggered

This is my script and editor. Do you see the problem as to why the animation plays before I can trigger it.

It also says this in the console

The AnimationClip ‘open door’ used by the Animation component ‘Gate’ must be marked as Legacy.

idk how to solve the “plays before triggered” problem, check if “Play Automatically” is not marked, and to get rid of the “Legacy” error just select the animation in the project window and go into Debug mode (click those 3 lines with an arrow pointing down next to the lock) then change Animation Type to 1.

Hope i did’t answer 2 times cuz my first reply is not appearing…

Thank you ger122 and CJGames, I have found it and got the respose that I wanted