Hi again! I am currently working on a game with a team and we want to recreate a Peggle mini-game. I've made some significant progress thanks to some YouTube videos but they seem to be done in Godot 3 and I'm working in Godot 4. I'm still relatively new to working on game dev and Godot and would like some help pls!! I've been stuck on this for a couple of weeks and can't seem to figure out whats wrong.

Im running into this problem with the pegs in the game that won't change color and disappear... i keep getting errors when I make changes in the code

using Godot;
using System;

public partial class pegDestroy : Node
{
	[Export]
	public double timeDestroy = 3.0f;
	double timeCount = 0f;
	bool isOn = false;
	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		// var area = this.GetParent().GetChild<Area2D>(3);
    	// area.Connect("body_entered", _on_body_entered);
		GetNode<Area2D>("../../Area2DNodeName").Connect("body_entered", this, "_body_entered");

    }
    
	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		if(isOn){
			timeCount += delta;
			if(timeCount > timeDestroy){
				Node body = this.GetParent();
				body.GetParent().RemoveChild(body);
				body.Dispose();
			}
		}
	}

	public void _body_entered(Node body){
		GD.Print("detect" + this.GetParent().Name);
		if(body.IsClass("RigidBody2D")&& body != GetParent()){
			isOn = true;
			var sprite = GetParent().GetNode<Sprite>("Sprite");
			if(sprite != null){
				sprite.Modulate = new Color(0.5f,0.5f,0.5f);
			}
		}
		
	}
}

    ghostlyy ok so first, you should read the docs on c#, there are several differences with how gdscript works, such as signals:
    https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_signals.html#doc-c-sharp-signals
    Second, I don't code in c# in godot, so maybe I'm not the best to answer this, but I noticed some things:

    You are trying to connect a Node2D? You should connect the signal of a node instead, or at least that's how it's done in gdscript. The docs also recommend using c# events.
    Also the method you are using looks like godot 3s, connecting signals in godot 4 is different.
    Edit: I think it's:
    GetNode<Area2D>("../../Area2DNodeName").body_entered += _body_entered

    You are receiving a Node and checking if it's a Rigidbody. IDK, try casting it first and then checking type?

    body.GetParent().RemoveChild(body);
    body.Dispose();

    Whatever this is. In gdscript we use the queue_free() Node method to destroy a node.
    Edit: I was correct, the c# version is QueueFree()