Hi, I am making a game where 1 player is chosen as a zombie and the rest are survivors.I am almost done with the scripting but I have one problem How do I check the number of players on the survivor team and if it is zero it does something.I only need a way to check the number of players nothing else
I made this code by using a free model for the intermission and following tutorials
local status = game.ReplicatedStorage:WaitForChild("Status")
while true do status.Value = "Intermission!" wait(5)
function setTeam(player, Spectator)
player.TeamColor = game.Teams[Spectator].TeamColor
if player.Character then --Just in case the character doesn't exist for some reason
player.Character:BreakJoints() -- Kills the players' character
end
end
--Changing everyone's team to "Reds"
for _, player in pairs(game.Players:GetPlayers()) do
setTeam(player, "Spectator")
end
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
randomPlayer.TeamColor = BrickColor.new("Camo")
p = game.Players:GetChildren()
for i = 1,#p do
p[i].Character.Head:remove()
end
status.Value = "Round in Progress"
wait(120)
function setTeam(player, Spectator) player.TeamColor = game.Teams[Spectator].TeamColor if player.Character then --Just in case the character doesn't exist for some reason player.Character:BreakJoints() -- Kills the players' character end end
--Changing everyone's team to "Reds" for _, player in pairs(game.Players:GetPlayers()) do setTeam(player, "Spectator") end status.Value = "Game Over!" wait(5) end
