TransWikia.com

Command block output - how many players in an area

Arqade Asked by Rdster on March 15, 2021

Is it possible to detect how many players are in an area with a testfor?

Will the command block output from a comparator equal the number found?

I’m working in 1.12.2.

I’d test myself, but am the only one currently on the server.

One Answer

The selector constraint r=[num] checks for entities within a radius of the executor.

/testfor @a[r=10]

This will test for all players within a radius of 10 meters of the command block, and will produce the correct comparator output up to 15.

Note that you could test this by yourself with armor stands and replacing @a with @e.

Answered by AMJ on March 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP