How to get damage variable from another script ?

Hello.

I want to know how to get a damage variable from another object with its own script attached.

I have a collision object that deals damage and 2 sword object with its own script attached.

Swords have a script where they are setting their transform with the players hand and public int Damage.

I have a collision object ( child of a player that gets activated when the player attacks) with script that deals damage to enemy.Collision object has a box collider set to triger and public intingeer called Ddamage;
I want to know how can I make the Ddamage have the same number as a damage in the sword ?

I have tried this ( In the start method
( PlayerSword = GetComponnent();
Ddamage = PlayerSword.DAMAGE)

I don’t know what is wrong.I must be blind or big Id**t I can’t find a way how to make this work.

Does anybody knows how to fix this ?

Something like this? (Please reformat your question, it’s horrible to look at)

void OnCollisionEnter2D(Collider2D col)
{
    var damageScript = col.gameObject.GetComponent<DamageScript>();
    var damage = damageScript.damage;

    var healthScript = gameObject.GetComponent<HealthScript>();
    healthScript.health -= damage;
}