2 player only detection

So i have a game that’s only for 2 players. But if 3 or more comes in to the game, then the game won’t work and won’t be fun.

So how do i make it so if the game detects a 3 or more players then they’ll turn into spectators? It’ll be like that until the 2nd player is removed, making the 3rd player the 2nd player.

make a lifecycle listen for a player that joins. Get 3 props (non active on game start), a counter, and make the target value 2. Then when player joins, shows one prop. run a check for the 3rd prop and see if its visible. then if the 3rd one visible, then make it do whatever you wanted it to do.

(idk if it works I didnt test it)

Set a counter to 0
Set the counter to store its value in a property
Relay on all players, wire it to a checker
Check if the property is greater than 2
If so, run a gamemode switcher that switches to spectator
Otherwise, do nothing


There’s no way to make a spectator a player (sadly, it’s really annoying) so you couldn’t do the “3rd player becoming 2nd player” thing.

But @Blackhole927 's method should work

yes there is. use a team switcher.

I didn’t mean “make a spectator a player”, i mean “make the 3rd or more player become a spectator”

1 Like

Wdym by gamemode switcher?

Oh that’s just me not knowing the names of devices I never use- it’s the device that you use to put people in spectator mode

1 Like

It’s team switcher. Also, @FersionSpeedy , I was talking about the last sentence of your post.

That part isn’t possible

so I did this, but for 15 players in my game. I have a “start game” button that all players have to press, and there are 15 true/false global properties “t1, t2…” and a number player property “loop” and a number player property “player” and make a trigger that loops and deactivates on channel “deactivate” and all scopes player scopes this is very important and write some block code like"if get property create text with “t” and get property loop = true set property loop get property loop+1 else set property create text with “t” and get property loop true set property player value get property “loop” broadcast message on channel “deactivate” if loop=16 broadcast message on channel switch" and then make a team switcher to spectators and switch when receiving on channel “switch”

how will that prevent all players from being switched to spectators though

The property starts at 0. It checks every player individually and updates that property for every player. Once that property is equal to 2 it will make every player checked after the first two that were checked a spectator. This all happens really really really fast though so you can’t see it. I used a system like this for my freeze tag map.

Well, my idea is that you could have a spawn pad and a trigger on top of the spawn pad. The trigger increments a counter-linked property [1] and runs a checker [2].
The checker then switches the player to spectator [3].

By the way, the trigger triggers when a player steps on it, you don’t need to change any settings of the trigger.

Is this what you’re looking for?

  1. number type, global scope ↩︎

  2. check for [property name], greater than 2 ↩︎

  3. which means any player beyond the second one gets switched to spectator ↩︎

or you could teleport them to a different room and have them watch with the camera point device, then when a player leaves, there could be a way to have that player take his place.

He left out some details I think. It is supposed to relay to the counter for all players and store that number in a property, then check if there are more than 2 players. If so switch the newest player (or the person on the highest numbered team) to spectator.

so how do you make sure not every player is checked at the exact same time? :thinking:

a simple way to do this is to have button that switches whoever the people playing choose to be a spectator to the spectator team. then, a counter checks players that walk over a zone before the game starts. if the zone makes the counter 2, it opens a barrier to the rest of the game. when that barrier deactivates, it activates another barrier on top of the zone, making it impossible for anyone else to get through. I can provide pictures if needed.

You test it. And it works, so It’s fine I guess.