I have two separate pieces of script here. Basically it displays a message if the team "survivors" has no players left. It works only in single player but when I tried to play with someone who always lags it failed to work.
function getTeam(team)
local players = game.Players:GetPlayers();
local teamPlayers = {};
for _, player in pairs(players) do
if player.TeamColor == team.TeamColor then
table.insert(teamPlayers, player);
end
end
return teamPlayers;
end
if #getTeam(game.Teams.Survivors) == 0 then
m = Instance.new("Message",Workspace)
m.Text = "The final survivor was infected. Once you respawn the round will begin!"
wait(3)
m:Destroy()
Any reasons why this wouldn't work? Thanks

4 comments
What exactly happens that shouldn't?
No message appears
That will only run once.
I know there is a separate part that renames the functions in order. Will it continuously check?