What could be the reason for the error?

Godot Version

4

Question

Direction is vector2, it can’t be compared by a single number.

There should be an error bar on the editor for the script parsing errors. Your snapshot didn’t show it or your detached window doesn’t have the script error bar.