Vector 2 nonexistent get_action_strenght

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By VestBeginner

I’m new to the godot engine and coding engine in general so i watch heartbeat video and followed the steps,but something went wrong so i need help
var velocity = Vector2.ZERO

func _physics_process(delta):
var Input = Vector2.ZERO
Input.x = Input.get_action_strength(“ui_right”) - Input.get_action_strength(“ui_left”)

:bust_in_silhouette: Reply From: jgodfrey

Input is a Godot-provided singleton. You’re creating a local variable with the same name here:

var Input = Vector2.ZERO

So, when you later try to access the Input singleton here:

Input.x = Input.get_action_strength("uiright") - Input.get_action_strength("ui_left")

your Input reference is not the singleton but is instead your local Vector2. The fix is to use a different local variable name in these two locations:

 var Input = Vector2.ZERO

 Input.x =...