Hi SonicproGamingYT
ME7G0RE is right, if an attacker is in his/her own half at the moment of the pass or touch to them, they are automatically onside.
And as a bonus, in the opponent's half, the offside rule applies to the second to last defender, but because the goalkeeper is usually in front of his/her goal, they are typically not the focus of reviews. However, if the attacker is in the opponent's half and behind the goalkeeper, there must be two outfield defenders closer to the goal than (the attacker) at the time of the pass or touch to them. The only exception is the ball, you are not offside if you are behind the ball at the time it is played to you.
All the best to both of you!