Pulse Works Studio
Attempt to call function 'play' in base 'Nil' on a null instance.
The call ran on null. The variable never received a node, or the node was freed.
Cause
The GDScript VM reports a null callee as base Nil. play() is the method you asked for; the failure is the instance, not a missing AnimationPlayer method. An @onready path that did not resolve, a freed node, or a function that returned null all look like this.
Fix
@onready var animation: AnimationPlayer = $AnimationPlayer
func play_hit() -> void:
if animation == null:
return
animation.play("hit")
Related
Godot Dev Tools is a Pulse Works Studio project. All error explainers.