# How can I identify all players within a given radius of a player?

Version 1.13

I'm creating a spell book, and have two self heal spells that are working fine, but I'm hitting a wall trying to make a group heal.

The working spell Heal 1 is a stack of six command blocks, always active, first on repeat, all others on chain. I have a scoreboard trigger for `spellHeal1`, and a spell book that activates the trigger when a player clicks the spell name. This is all working currently.

Command blocks:

``````1: execute as @a[level=1..,scores={spellHeal1=1}] run scoreboard players set @s spellHeal1 2
2: scoreboard players set @a[scores={spellHeal1=1}] spellHeal1 0
3: xp add @a[scores={spellHeal1=2}] -7 points
4: effect give @a[scores={spellHeal1=2}] minecraft:instant_health
5: scoreboard players set @a[scores={spellHeal1=2}] spellHeal1 0
6: scoreboard players enable @a spellHeal1
``````

For the group heal, blocks 1-3 will still work for identifying the player casting the spell, resetting it for anyone that didn't have enough XP, and subtracting XP for successful casters. Blocks 5 and 6 will work for resetting the spell trigger for everyone every cycle.

I need to replace block 4 with something that will give the effect to all players within a 10 block radius of the players with `spellHeal1=2` (i.e. the casters). I'm thinking it'll be something along the lines of creating an invisible entity at player location, or maybe a falling_block, and then giving the effect within a radius of that, but I'm hitting a mental block here. I've never used either of those things, just played with them a bit following tutorials. I haven't fully wrapped my head around properly implementing them.

Any ideas?

• Honestly I didn't read it all, but couldn't you just do something like `execute at @a[bla] as @a[distance=..10]`? Commented Feb 25, 2019 at 7:31
• That was it! thank you. I definitely missed the mark on this one. Commented Feb 26, 2019 at 1:53

As @Fabian alluded to in his comment, it should be a simple matter to replace command 4 with an `execute` command:
``````execute at @a[scores={spellHeal2=2}] run effect give @a[distance=..10] minecraft:instant_health
What this does is run the `effect` command at the location of the spell caster, and target all players within 10m of them.
Another option would be `summon` a splash potion at the spell caster's location (again, you would need to `execute at @a[...]`), but there's potentially some downsides to this, such as range limitations and uneven healing.