I've tried doing this for detecting 1 player and I see the scoreboard go up to 1 on the sidebar but I can't seem to get the detection to work.
I'm using these 3 commands
/execute as @a[x=342,y=159,z=384,dx=-116,dy=40,dz=116] run scoreboard players add @a detect 1
/execute if score @p detect matches 1 run setblock 315 152 438 redstone_block
/scoreboard players set @a detect 0
the scoreboard detect is just a dummy
If I leave it as matches ..1 it also detects if there is nobody there. I am trying to avoid that as there is multiple minigames we already have in the map I need it to detect 1. no more and no less.
i have a question about this, when i do what you said for the only 1 team, it just keeps adding 1 to the score when there is one or more than one player in the area. is this normal?
I'm making my own fighting arena to play with friends and have everything set up except ending the game.
all I need is a way to detect if only 1 player is in a specific area. there can only be one though. if possible only 1 team.
Let's say the arena is from (x:321 y:50 z: -15) to (x: 366 y:67 z: -60) and you have a scoreboard "kermit"
scoreboard players set trash kermit 0
execute as @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45] run scoreboard players add trash kermit 1
execute if score trash kermit matches ..1 run <Your commands...>
The above 2 commands only detects if 1 player is alive. It runs in repeating mode.
If you don't like the last man standing method, try this:
Now let's say you have 5 teams: 1, bananas, rick, tnt, yo_mama
scoreboard players set trash kermit 0
execute if entity @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45,team=1] run scoreboard players add trash kermit 1
execute if entity @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45,team=bananas] run scoreboard players add trash kermit 1
execute if entity @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45,team=rick] run scoreboard players add trash kermit 1
execute if entity @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45,team=tnt] run scoreboard players add trash kermit 1
execute if entity @a[x=321,y=50,z=-15,dx=45,dy=17,dz=-45,team=yo_mama] run scoreboard players add trash kermit 1
execute if score trash kermit matches ..1 run <Your command>
This is the last team alive, also running in repeating mode.
That should be it. Feel free to ask more if you want to.
I've tried doing this for detecting 1 player and I see the scoreboard go up to 1 on the sidebar but I can't seem to get the detection to work.
I'm using these 3 commands
/execute as @a[x=342,y=159,z=384,dx=-116,dy=40,dz=116] run scoreboard players add @a detect 1
/execute if score @p detect matches 1 run setblock 315 152 438 redstone_block
/scoreboard players set @a detect 0
the scoreboard detect is just a dummy
If I leave it as matches ..1 it also detects if there is nobody there. I am trying to avoid that as there is multiple minigames we already have in the map I need it to detect 1. no more and no less.
I have gotten the detection to work by setting the 2 execute commands on a comparitor pulse clock
it is consistant so I can work with this. Thank you.
update. While that is still on a pulse clock I changed
/execute if score @p detect matches 1 run setblock 315 152 438 redstone_block
to
/execute if score @p detect matches 1 run scoreboard players set @a detect1 10
and I have another repeating command block that is set to
/scoreboard playsers remove @a[scores={detect1=1..100}] detect1 1
So... does it work?
Yes. I have it set up to where it should work. I'll have to wait until I have a second person to test with
i have a question about this, when i do what you said for the only 1 team, it just keeps adding 1 to the score when there is one or more than one player in the area. is this normal?
Is this literally the only way to detect if there's more than 1 player/entity?
Before you could just use count= Why is it so complicated now?
-L0ST