Not enough information... could be a number of things...
Do you get errors in the debugger? If so, could you copy/paste them here?
What node is this script attached to? What nodes are in the tree?
There are a lot of tutorials out there for this ... Try a YouTube search for Godot animation tutorials.