Hello, I was wondering if there is a way to run a command when any player leaves the game. I have an objective set up that runs when a player leaves the game. I can't seem to figure out how to test for players with a score in the objective, unless they rejoin. I am trying to remove 1 player from the playerCount on leaving, in order for my game to work properly.
Hello, I was wondering if there is a way to run a command when any player leaves the game. I have an objective set up that runs when a player leaves the game. I can't seem to figure out how to test for players with a score in the objective, unless they rejoin. I am trying to remove 1 player from the playerCount on leaving, in order for my game to work properly.
Thanks in advance
you could do it like this:
Repeat these commands and you Always have an up-to-date player count.
It's not exactly 'running a command when a player leaves', but as I read your post, it looks like you just need the current player count.
If you want to check if the playerCount changes, you could add this command before the first two:
and then after the first two commands:
to execute a command when the playerCount changes would look like this: