How can I solve the virtual line problem I created with RayCast2D?

I want to make a Bubble Shooter style work with Godot Engine 4.3 and I need to draw a virtual line during launch. First, I created the RayCast2D node and added 2 Line2Ds as “LineOne and LineTwo” as its child nodes. Then, when I targeted this virtual line to objects, I wanted the objects to get the color I assigned to their IDs. Now the things I targeted with the code I gave below are working correctly, but the virtual line “LineTwo” is working, but this code cannot get the color of the targeted object with “dl.default_color = get_collider().color” and also “dl.points[1].x = vector_line_length” with this code, the virtual line does not end after reaching the targeted object. These two lines of code are not working in my project. How can I solve this correctly? Thank you for your help.

My Codes:
"

extends RayCast2D
@onready var vl = $LineOne
@onready var dl = $LineTwo
var vector_line_length = 600
@onready var manager = $"../Manager"
var default_color: Color = Color(0.388,0.643,0.969,1)

func _physics_process(_delta: float) -> void:
	
	if not $"../Shoot”.was_shooted:

		vl.visible = true
		dl.visible = true

		if $"../Shoot”.can_be_shot:
			look_at(get_global_mouse_position())

		if is_colliding():
			if not manager.items.has(get_collider()):
				var collision_point = to_local(get_collision_point())
				vl.default_color = default_color
				dl.default_color = default_color
				vl.points[1].x = collision_point.x
				dl.position = collision_point
				dl.rotation_degrees = (rotation_degrees * 2) * -1
				dl.visible = true
			else:
				var collision_point = to_local(get_collision_point())
				if get_collider().color != null:
					vl.default_color = get_collider().color
					dl.default_color = get_collider().color
				else:
					vl.default_color = default_color
					dl.default_color = default_color
				vl.points[1].x = collision_point.x
				dl.visible = false
		else:
			vl.default_color = default_color
			vl.points[1].x = vector_line_length
			dl.points[1].x = vector_line_length
			
	else:
		vl.visible = false
		dl.visible = false

"

I’m not sure what you mean by “I wanted the objects to get the color I assigned to their IDs”. How and where did you assign the colors?

I created each object in different scenes and assigned ID and color to them using the StaticBody2D node in those scenes to ensure that each object appears randomly on the screen and at which level the colors I want.
The LineOne is working correctly and if you look at the code you will notice it, but the LineTwo is not working and I need help here.

I’m sorry. Perhaps I need more context, but I’m not sure what the code is supposed to be doing.

What is the purpose of the two lines, why are there two of them, and what is different about them? They share a single RayCast2D and collision hit, correct?

Maybe you can add some comments that explain what certain sections of your code are responsible for and/or a screenshot to better illustrate the problem?