Couldnt find duplicate code

4.3`

I’m building the gameplay code for my basketball game


	Globals.home_team = load("res://Team.gd").instantiate()
	Globals.home_team.set_name(str(get_tree().get_unique_id()))
	Globals.home_team.set_multiplayer_authority(get_tree().get_unique_id())
	Globals.road_team.center = Globals.home_team.center.get_position(0.111, 0.155, 0.451).global_transform
	Globals.road_team.center = Globals.home_team.backcourt.get_position(0.716, 0.155, -0.082).global_transform
	Globals.road_team.center = Globals.home_team.frontcourt.get_position(0.716, 0.155, 0.082).global_transform
	add_child(Globals.home_team)
	Globals.road_team = load("res://Team.gd").instantiate()
	Globals.road_team.set_name(str(Globals.road_team_id))
	Globals.road_team.set_multiplayer_authority(Globals.road_team_id)
	Globals.road_team.center = Globals.road_team.center.get_position(-0.111, 0.155, 0.451).global_transform
	Globals.road_team.center = Globals.road_team.backcourt.get_position(-0.716, 0.155, -0.082).global_transform
	Globals.road_team.center = Globals.road_team.frontcourt.get_position(-0.716, 0.155, 0.082).global_transform
	add_child(Globals.road_team)
	
	if Globals.player_one == Globals.home_team:
		var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
		var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
		var left_vec = Vector2(left_horz, left_vert)
		if left_vec.length_squared() > 0.1:
			Globals.home_team.current_player.direction = 1
			print("Left Analog: ", left_vec)
		if Globals.offense:
			# Right Trigger
			var right_trigger_pos = Input.get_action_strength("right_trigger_pos")
			var right_trigger_neg = Input.get_action_strength("right_trigger_neg")
			if right_trigger_pos + right_trigger_neg > 0.1:
					right_trigger_pos *= 0.5
					right_trigger_neg = 0.5 - right_trigger_neg * 0.5
			var right_trigger = right_trigger_pos + right_trigger_neg
			if right_trigger > 0.1:
					print("Right Trigger: ", right_trigger)
					Globals.home_team.shooting()
			# Left Trigger
		var left_trigger_pos = Input.get_action_strength("left_trigger_pos")
		var left_trigger_neg = Input.get_action_strength("left_trigger_neg")
		if left_trigger_pos + left_trigger_neg > 0.1:
			left_trigger_pos *= 0.5
			left_trigger_neg = 0.5 - left_trigger_neg * 0.5
		var left_trigger = left_trigger_pos + left_trigger_neg
		if left_trigger > 0.1:
			print("Left Trigger: ", left_trigger)
			Globals.home_team.passing()
	if Globals.player_one == Globals.road_team:
		var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
		var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
		var left_vec = Vector2(left_horz, left_vert)
		if left_vec.length_squared() > 0.1:
			Globals.home_team.current_player.direction = 1
			print("Left Analog: ", left_vec)
		if Globals.offense:
			# Right Trigger
			var right_trigger_pos = Input.get_action_strength("right_trigger_pos")
			var right_trigger_neg = Input.get_action_strength("right_trigger_neg")
			if right_trigger_pos + right_trigger_neg > 0.1:
				right_trigger_pos *= 0.5
				right_trigger_neg = 0.5 - right_trigger_neg * 0.5
			var right_trigger = right_trigger_pos + right_trigger_neg
			if right_trigger > 0.1:
				print("Right Trigger: ", right_trigger)
				Globals.road_team.shooting()
			# Left Trigger
			var left_trigger_pos = Input.get_action_strength("left_trigger_pos")
			var left_trigger_neg = Input.get_action_strength("left_trigger_neg")
		if left_trigger_pos + left_trigger_neg > 0.1:
			left_trigger_pos *= 0.5
			left_trigger_neg = 0.5 - left_trigger_neg * 0.5
		var left_trigger = left_trigger_pos + left_trigger_neg
		if left_trigger > 0.1:
			print("Left Trigger: ", left_trigger)
			Globals.road_team.passing()
				
	elif Globals.player_two == Globals.home_team:
		# Left Analog Stick
		var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
		var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
		var left_vec = Vector2(left_horz, left_vert)
		if left_vec.length_squared() > 0.1:
			print("Left Analog: ", left_vec)
			Globals.home_team.current_player.direction = 1
		if Globals.offense:
			var right_trigger_pos = Input.get_action_strength("right_trigger_pos")
			var right_trigger_neg = Input.get_action_strength("right_trigger_neg")
			if right_trigger_pos + right_trigger_neg > 0.1:
				right_trigger_pos *= 0.5
				right_trigger_neg = 0.5 - right_trigger_neg * 0.5
			var right_trigger = right_trigger_pos + right_trigger_neg
			if right_trigger > 0.1:
				print("Right Trigger: ", right_trigger)
				Globals.home_team.shooting()
			# Left Trigger
			var left_trigger_pos = Input.get_action_strength("left_trigger_pos")
			var left_trigger_neg = Input.get_action_strength("left_trigger_neg")
			if left_trigger_pos + left_trigger_neg > 0.1:
				left_trigger_pos *= 0.5
				left_trigger_neg = 0.5 - left_trigger_neg * 0.5
			var left_trigger = left_trigger_pos + left_trigger_neg
			if left_trigger > 0.1:
				print("Left Trigger: ", left_trigger)
				Globals.home_team.passing()
		elif Globals.player_one == Globals.road_team:
			var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
			var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
			var left_vec = Vector2(left_horz, left_vert)
			if left_vec.length_squared() > 0.1:
				print("Left Analog: ", left_vec)
				Globals.road_team.current_player.direction = 1
			if Globals.offense:
			# Right Trigger
				var right_trigger_pos = Input.get_action_strength("right_trigger_pos")
				var right_trigger_neg = Input.get_action_strength("right_trigger_neg")
				if right_trigger_pos + right_trigger_neg > 0.1:
					right_trigger_pos *= 0.5
					right_trigger_neg = 0.5 - right_trigger_neg * 0.5
				var right_trigger = right_trigger_pos + right_trigger_neg
				if right_trigger > 0.1:
					print("Right Trigger: ", right_trigger)
					Globals.road_team.shooting()
		# Left Trigger
				var left_trigger_pos = Input.get_action_strength("left_trigger_pos")
				var left_trigger_neg = Input.get_action_strength("left_trigger_neg")
				if left_trigger_pos + left_trigger_neg > 0.1:
					left_trigger_pos *= 0.5
					left_trigger_neg = 0.5 - left_trigger_neg * 0.5
				var left_trigger = left_trigger_pos + left_trigger_neg
				if left_trigger > 0.1:
					print("Left Trigger: ", left_trigger)
					Globals.road_team.passing()
		
	elif Globals.player_two == Globals.road_team:
		# Left Analog Stick
		var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
		var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
		var left_vec = Vector2(left_horz, left_vert)
		if left_vec.length_squared() > 0.1:
			print("Left Analog: ", left_vec)
			Globals.road_team.current_player.direction = 1
		if Globals.offense:
			# Right Trigger
			var right_trigger_pos = Input.get_action_strength("right_trigger_pos")
			var right_trigger_neg = Input.get_action_strength("right_trigger_neg")
			if right_trigger_pos + right_trigger_neg > 0.1:
				right_trigger_pos *= 0.5
				right_trigger_neg = 0.5 - right_trigger_neg * 0.5
			var right_trigger = right_trigger_pos + right_trigger_neg
			if right_trigger > 0.1:
				print("Right Trigger: ", right_trigger)
				Globals.road_team.shooting()
			# Left Trigger
			var left_trigger_pos = Input.get_action_strength("left_trigger_pos")
			var left_trigger_neg = Input.get_action_strength("left_trigger_neg")
			if left_trigger_pos + left_trigger_neg > 0.1:
				left_trigger_pos *= 0.5
				left_trigger_neg = 0.5 - left_trigger_neg * 0.5
			var left_trigger = left_trigger_pos + left_trigger_neg
			if left_trigger > 0.1:
				print("Left Trigger: ", left_trigger)
				Globals.road_team.passing()

	if Globals.player_one == Globals.home_team:
		
		# Joystick Directions
		if Input.is_action_just_pressed("joystick_up"):
			print("Joystick: Up")
		if Input.is_action_just_pressed("joystick_down"):
			print("Joystick: Down")
		if Input.is_action_just_pressed("joystick_left"):
			print("Joystick: Left")
		if Input.is_action_just_pressed("joystick_right"):
			print("Joystick: Right")
		# Joystick Rotation
		var joy_axis_current = Input.get_joy_axis(1, 0)
		var joy_axis_delta = joy_axis_current - joy_axis_last
		if abs(joy_axis_delta) > 0.01 and joy_axis_last != 0:
			print("Joystick: Rotate ", joy_axis_delta * 100.0)
		joy_axis_last = joy_axis_current
		
		if Globals.offense:
				# Face Buttons
			if Input.is_action_just_pressed("button_primary"):
				print("Button: Primary")
				Globals.home_team.passing()
			if Input.is_action_just_pressed("button_secondary"):
				print("Button: Secondary")
				Globals.home_team.shooting()
		
	if Globals.player_one == Globals.road_team:
		
		# Joystick Directions
		if Input.is_action_just_pressed("joystick_up"):
			print("Joystick: Up")
		if Input.is_action_just_pressed("joystick_down"):
			print("Joystick: Down")
		if Input.is_action_just_pressed("joystick_left"):
			print("Joystick: Left")
		if Input.is_action_just_pressed("joystick_right"):
			print("Joystick: Right")
		# Joystick Rotation
		var joy_axis_current = Input.get_joy_axis(1, 0)
		var joy_axis_delta = joy_axis_current - joy_axis_last
		if abs(joy_axis_delta) > 0.01 and joy_axis_last != 0:
			print("Joystick: Rotate ", joy_axis_delta * 100.0)
		joy_axis_last = joy_axis_current
		
		if Globals.offense:
				# Face Buttons
			if Input.is_action_just_pressed("button_primary"):
				print("Button: Primary")
				Globals.road_team.passing()
			if Input.is_action_just_pressed("button_secondary"):
				print("Button: Secondary")
				Globals.road_team.shooting()

		if Globals.player_two == Globals.home_team:
		
			# Joystick Directions
			if Input.is_action_just_pressed("joystick_up"):
				print("Joystick: Up")
			if Input.is_action_just_pressed("joystick_down"):
				print("Joystick: Down")
			if Input.is_action_just_pressed("joystick_left"):
				print("Joystick: Left")
			if Input.is_action_just_pressed("joystick_right"):
				print("Joystick: Right")
			# Joystick Rotation
			var joy_axis_current = Input.get_joy_axis(1, 0)
			var joy_axis_delta = joy_axis_current - joy_axis_last
			if abs(joy_axis_delta) > 0.01 and joy_axis_last != 0:
				print("Joystick: Rotate ", joy_axis_delta * 100.0)
			joy_axis_last = joy_axis_current
		
		if Globals.offense:
			# Face Buttons
			if Input.is_action_just_pressed("button_primary"):
				print("Button: Primary")
				Globals.home_team.passing()
			if Input.is_action_just_pressed("button_secondary"):
				print("Button: Secondary")
				Globals.home_team.shooting()
		
	if Globals.player_two == Globals.road_team:
		
		# Joystick Directions
		if Input.is_action_just_pressed("joystick_up"):
			print("Joystick: Up")
		if Input.is_action_just_pressed("joystick_down"):
			print("Joystick: Down")
		if Input.is_action_just_pressed("joystick_left"):
			print("Joystick: Left")
		if Input.is_action_just_pressed("joystick_right"):
			print("Joystick: Right")
		# Joystick Rotation
		var joy_axis_current = Input.get_joy_axis(1, 0)
		var joy_axis_delta = joy_axis_current - joy_axis_last
		if abs(joy_axis_delta) > 0.01 and joy_axis_last != 0:
			print("Joystick: Rotate ", joy_axis_delta * 100.0)
		joy_axis_last = joy_axis_current
		
		if Globals.offense:
				# Face Buttons
			if Input.is_action_just_pressed("button_primary"):
				print("Button: Primary")
				Globals.road_team.passing()
			if Input.is_action_just_pressed("button_secondary"):
				print("Button: Secondary")
				Globals.road_team.shooting()

I got this error from this


var left_horz = Input.get_action_strength("left_stick_right") - Input.get_action_strength("left_stick_left")
			var left_vert = Input.get_action_strength("left_stick_up") - Input.get_action_strength("left_stick_down")
			var left_vec = Vector2(left_horz, left_vert)

and this

			var joy_axis_current = Input.get_joy_axis(1, 0)
			var joy_axis_delta = joy_axis_current - joy_axis_last

Line 141:There is already a variable named “left_vert” declared in this scope.
Line 142:There is already a variable named “left_vec” declared in this scope.
Line 264:There is already a variable named “joy_axis_current” declared in this scope.
Line 265:There is already a variable named “joy_axis_delta” declared in this scope.

I checked the code and couldnt dind duplicate code

Is where it’s defined first, and then

Your indentation is wrong, that block is inside the code above where it is defined