Gives a buff to allies within range

I’m trying to create a rule that “reduces damage received by allies other than self within range by 20%” .
Also, the buff will be cleared if the ally who received the buff goes out of range.
Everything I tried didn’t work. please tell me what to do?

The action is: Start Damage Modification. This action doesn’t stop checking its values.

To reduce damage received by allies within, let’s say, 5 meters from the player (this one excluded):

Start Damage Modification(Remove From Array(Players Within Radius(Event Player, 5, Team Of(Event Player), Surfaces), Event Player), All Players(Opposite Team Of(Team Of(Event Player)), 80, Receivers Damagers And Damage Percent)

This rule sets the damage received by the players within a 5 m radius of the event player team to 80% (20% reduction) who are damaged by any player from the enemy team.

In case you want to stop that action, you have to save its ID in a variable (global or player) right after the action:

Event Player.A = Last Damage Modification ID

And stop it when you want using this action:

Stop Damage Modification(Event Player.A)

More info: