Arqade Asked by Danny Varod on March 7, 2021
How can I program a command block (or a combination of blocks) to teleport nearby player only if there is exactly one player nearby?
I.e. when button pressed, if there are more than one player within a radius of 6 blocks, don’t teleport.
I tried two approaches:
combining /execute if score
with /testfor
using testfor
with a comparer
block to compare with the constant 1
The first approach resulted in a syntax error.
The second approach the command block
output was stuck on _
and I also couldn’t find a way to enter 1
into the the comparer
(no constant option in the command block
documentation)
I have tested this on the latest versions of Minecraft for Android (1.5.1) and for Xbox (1.5.1), both Bedrock editions.
Is there any way to do this?
Testfor is in P.E.
/testfor @a[r=3]
This will activate when someone is in a 3 block radius (Toggle the number as needed) also add c to toggle the max.
Example: testfor @a[r=3,c=5]
Comparators will produce a current from one to five which is max detection limit is 5.
Testfor was removed in version 1.13 (aka the “aquatic update”) on the computer. Also the “r” was replaced with the word “distance”. Computer players should use the following.
Execute @a[distance=3] ~ ~ ~ (your command here)
(Computer information was found on Minecraftforum.net by user OuOun)
Answered by Bratworst on March 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP