How do I add two variables together?

I want to know how to add two variables together but unity keeps saying "
Expressions in statements must only be executed for their side-effects."

I don’t know how to make the code work correctly

does anyone know what i need to do.

here’s the code:

var PointsGiven : float;
function OnTriggerEnter(other : Collider){
if (other.tag == "Robot"){
other.P1Points.Control + PointsGiven;
}
}

Any help would be greatly appreciated.

What is P1Points ? You should cast your collider from “Collider” to the object you expect.

And I think you want to do this :

var PointsGiven : float;
function OnTriggerEnter(other : Collider){
    if (other.tag == "Robot"){
        other.P1Points.Control += PointsGiven;
    }
}

or :

var PointsGiven : float;
function OnTriggerEnter(other : Collider){
    if (other.tag == "Robot"){
        other.P1Points.Control = other.P1Points.Control + PointsGiven;
    }
}