An attack is a type of action in which one character intends to harm, take out, damage, or otherwise negatively affect either another character or a non-character target.
Attacks in a role-playing game may use that game's standard resolution mechanic or a separate mechanic specifically designed for that purpose. Different games will have different rules about whether attacks can be physical or mental or social, whether they can be made in melee or at range, whether they can or must use weapons or magic, as well as what sort of effects a successful attack causes (e.g. damage, loss of hit points, imposing conditions, death).
Attacks are one of the most common types of regulated action in role-playing games (talking being often unregulated, i.e. done without rules), especially in the action-adventure genre. While attacks can be one-off actions regardless of context, it is common for games to delineate part of the game as combat, in which multiple sides try to attack each other or by other means defeat or take each other out.