Wayyllon
(Wayyllon)
April 16, 2022, 5:39pm
#1
Okay, so I’m working on a minigames game, super original I know.
Currently I’m working on the player management, & I want it to cancel intermission/end the mini game if there’s less than 3 players.
I’m not sure how to do this. That’s the question, that’s it.
I didnt wanna make a devforum post because its such a tiny question but I didnt know where else to go.
Thanks!
1 Like
Valkyrop
(JustAGuy)
April 16, 2022, 5:48pm
#2
You could use #game.Players:GetPlayers()
to check how many players are left in your game,
in your case, you would do something like this :
if #game.Players:GetPlayers() < 3 then
--cancel intermission/end round here
end
Wayyllon
(Wayyllon)
April 16, 2022, 5:50pm
#3
I know that much, my issue is that I need it to do this constantly and im not sure how I would do that
Wayyllon
(Wayyllon)
April 16, 2022, 6:09pm
#4
I uhhh, I need to know how to do this.
Instead of doing it constantly, you could check it every time a player leaves or joins.
local function checkPlayerCount()
if #game.Players:GetPlayers() < MIN_PLAYER_COUNT then
-- do something
end
end
players.PlayerAdded:Connect(checkPlayerCount)
players.PlayerRemoving:Connect(checkPlayerCount)
Wayyllon
(Wayyllon)
April 16, 2022, 6:14pm
#6
im not sure how to express it, I know how to stop everything, but I need to know how to run it all at the same time as the other stuff