Script not working?

Hi, I am making a 2D Game, and I am having an error with this script:

I don’t know what to do with the var error.
Can someone help me please?
Also notice that the word’s “play” on line 23 and “time” on line 24 are red. That means they are errors too, its just that the error is hidden.

You can’t use ‘var’ outside of functions, change that to either ‘int’ if you want whole numbers, or ‘float’ if you want decimals.

The reason Play and time are both errors is because ‘animation’ simply doesn’t exist. You’ll have to create a variable of type ‘Animator’ and then get the animator component before you can do what you’re trying,


you shouldnt use var in c#

instead use a float value like this:

public float Health = 100f;