The error code is telling you that you are incorrectly trying to access a member knockback_vector
of a type Vector2. Indeed this is the case.
First, you assign swordHitbox
with what appears to be a hitbox in the scene tree with the line of code:
onready var swordHitbox = $HitboxPivot/SwordHitbox
This seems correct. However, in your ready function, you override/erase the reference to a hitbox with an empty Vector2
swordHitbox = Vector2.ZERO
swordHitbox
no longer references a hitbox object, it's now a Vector2. You proceed to access a member knockback_vector
of this empty vector
swordHitbox.knockback_vector = input_vector
Either remove swordHitbox = Vector2.ZERO
or rethink your logic, because you are using the swordHitbox
variable to store different types of variables (a hitbox and Vector2), which is bad design and can quickly get messy