[OUTDATED] Detect the number of players in your game! (player counter) [Difficulty: 🟧]

Hey you! Yeah you! Want to detect how many players enter your game, so you can do things like Last Man Standing (end game when there is one person left), and other things like that? It’s really easy:

Oookay, maybe it’s a bit more complex than I though it would be.
Let’s break it down!

First, place a zone. Ideally, you would want to place it on top of Spawn Pad Devices so that it could detect the players that spawn there. Make sure the Zone disabled on game start.

For simplicity, I’m going to use a Button Device, but you can use any device that could trigger a zone! Place the Button down in the radius of the Zone. You shouldn’t have to change anything to get about the Button to get it to work. Connect the Button (first) to the Zone (after) with wires. Check the boxes as follows:

Now we have to actually detect the players in the Zone. Add a Counter Device (shouldn’t have to change anything about the device in this case), and connect the Zone and the Counter together with wires. It should look like this:


[For Advanced Gim’s: Update a Property Device using the Counter Device for more complex things like a Game Overlay showing the amount of players in a Game!]

Anyways, we are almost done! All we got to do now is disable the Zone after we’re done (so no one enters the zone twice). Add a Wire Repeater Device. Change the delay of the Device to 0.1 seconds. Then, wire the Button to the Wire Repeater. It should look like this:

Lastly, connect the Wire Repeater Device to the Zone to disable it. It should look like this:

And that’s it! You should be able to detect the amount of players that are in the zone, which can be used to detect the amount of players in the whole map.
Whew, that was a lot to get through.

If what I said was confusing and you didn’t understand, or you have a question, just ping me and I should be able to help you! Have fun!

-Lolo

9 Likes

Is it fine if I make another tutorial on this, but with an alternate method?

6 Likes

no offense but you could also just use lifecycle and relay device, increase the value of the counter, and decrease it when a player is knocked out

6 Likes

Ooh, why didn’t I think of that! :man_facepalming: You should make a Guide of that yourself, don’t want to steal your idea lol

4 Likes

And of course! Do as you wish. (not really good at this Guide thing, @kyro proved that XD)

4 Likes

LOL your guide was fine! it works and it is pretty hard to think of many different solutions to one problem

5 Likes

Yeah, totally agree. The funniest thing about it is that my solution was actually a simplification from someone else’s solution!

4 Likes

I have a question: What if no one clicks the button? And also, what would happen if you didn’t delay the action by 0.1 seconds?

Also as a side question: Is the wire repeater basically a way to give delays and wire more things?

2 Likes

I don’t know why the action is delayed by 0.1. However, the wire repeater can be used for: Combining wires into one, adding delays to wires, and looping a wire back to where it came from (counter → wire repeater → counter).
I hope that helps!

2 Likes
  1. Might not give the zone enough time to detect any players. Haven’t tested it yet.

  2. Yes! Exactly.

3 Likes

@Lolo I followed the steps - but somehow when all players come to a zone, it wouldn’t end the game

2 Likes

What if a player leaves the game? would it work then?

2 Likes

No, and I don’t think there is a way to detect when someone leaves at all tbh

3 Likes

I think you could put a zone on the entire map and increase a counter when someone enters, and decrease the counter when someone leaves it

2 Likes

Created an updated (and way easier) version of this Guide! Check it out!

Like stated it in the title, credits to @kyro :slight_smile:

5 Likes

Bump

I detect a bump somewhere around here…

3 Likes

You guys get really creative with these!
Might want to bump the new one instead; this one is outdated.

3 Likes

@mysz, can you edit the title of this post to add “Outdated” somewhere on it? I don’t want people to waste memory when there is a much easier way.

Once again, for people trying to look for it, here is the up-to-date version!

2 Likes