wait(1); -- Jaredvaldez4 2011
--game.Lighting.Ambient = BrickColor.new("Bright green").Color;
system = script.Parent
is_playing = system.Playing
stage = system.Stage
weapons = game.Workspace.Weapons
hum_team = game.Teams["Humans"]
zom_team = game.Teams["Zombies"]
msg = nil
hint = nil
playing = false
interrupted = false
minutes = 0
seconds = 0
function displayHint(text)
if(hint==nil)then
hint = Instance.new("Hint")
hint.Text = text
hint.Parent = game.Workspace
else
hint.Text = text
end
end
function removeHint()
if(hint~=nil)then
hint:remove()
hint = nil
end
end
function displayMsg(text)
if(msg==nil)then
msg = Instance.new("Message")
msg.Text = text
msg.Parent = game.Workspace
else
msg.Text = text
end
end
function removeMsg()
if(msg~=nil)then
msg:remove() msg = nil
end
end
function giveWeapons()
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p].TeamColor==hum_team.TeamColor)then
shared["Weps"]["Pistol"]:Clone().Parent = player[p].Backpack
end
end
end
end
function killPlayers()
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p].Character~=nil)then
local h = player[p].Character:FindFirstChild("Humanoid")
if(h.Health>0)then
player[p].Character.Humanoid.Health = 0
else
if(player[p]:FindFirstChild("Dead")~=nil)then
player[p].Dead.Value = false
player[p].Class.Value = "Zombie"
player[p].TeamColor = hum_team.TeamColor
end
end
end
end
end
end
function resetPlayers()
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p]:FindFirstChild("Dead")~=nil)then
player[p].Dead.Value = false
player[p].Class.Value = "Zombie"
player[p].TeamColor = hum_team.TeamColor
end
end
end
end
function countPlayers()
local count = 0
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p].Character~=nil)then
count = count +1
end
end
end
return count
end
function countPlayersInTeam(team)
local team_count = 0
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p].TeamColor==team.TeamColor)then
team_count = team_count +1
end
end
end
return team_count
end
function assignZombies(amount)
local valid_players = {}
local player = game.Players:GetChildren()
if(#player>0)then
for p = 1, #player do
if(player[p].TeamColor==hum_team.TeamColor)and(player[p].Character~=nil)then
table.insert(valid_players,player[p])
end
end
end
if(#valid_players>amount)then
while(amount>0)do
local rand = math.random(1,#valid_players)
local chosen = valid_players[rand]
chosen.TeamColor = zom_team.TeamColor
chosen.Character.Humanoid.Health = 0
table.remove(valid_players,rand)
amount = amount -1
end
end
end
function countDown()
seconds = seconds -1
if(seconds<0)then
minutes = minutes -1
seconds = 59
if(minutes<0)then
playing = false
return true
end
end
return false
end
function playZombies()
resetPlayers()
for i,v in pairs(game.Players:GetPlayers()) do
Spawn(function()
repeat
wait(0)
until v.Character and v.Character:FindFirstChild("Torso")
v.Character.Torso.Anchored = true
repeat
wait(0)
until v
end)
end
is_playing.Value = true
-- ================================================================================== --
-- =============================######CHANGE MAP######=============================== --
-- ================================================================================== --
if not game.Lighting:FindFirstChild("Maps") then
local MapsContainer = Instance.new("Model", game.Lighting)
MapsContainer.Name = "Maps"
end
if #game.Lighting.Maps:GetChildren() == 0 then
displayMsg("There are no loaded maps, can't play!")
return;
else
if workspace:FindFirstChild("cMAP") then
workspace.cMAP:Destroy()
end
for i = 1, math.random(10,30) do
for ii = 1, #game.Lighting.Maps:GetChildren() do
displayMsg("Picking Map.... >"..game.Lighting.Maps:GetChildren()[ii].Name.."<")
wait(0.1337331337331337331337)
game.Workspace.swoosh:Play()
end
wait(0)
end
local xzkx = game.Lighting.Maps:GetChildren()[math.random(#game.Lighting.Maps:GetChildren())]:Clone()
displayMsg("Picking Map....... >>>>>>" .. xzkx.Name .. "<<<<<<")
game.Workspace.swoosh:Play()
wait(11)
removeMsg()
if (xzkx) then
xzkx.Name = "cMAP"
xzkx.Parent = workspace
else
displayMsg("Map is null for some awkward reason")
end
end
if(countPlayers()<=3)then
assignZombies(1)
elseif(countPlayers()<=6)then
assignZombies(2)
else
assignZombies(3)
end
displayMsg("Survive for 13 minutes without getting infected!")
for i,v in ipairs(game.Players:GetPlayers()) do -- Should fix zombies not morphing.
-- if v.TeamColor == zom_team.TeamColor then
v:LoadCharacter()
-- end
end
delay(5,function () giveWeapons(); end); -- Wait for respawns?
delay(5,removeMsg)
interrupted = false
playing = true
minutes = 12
seconds = 59
while(playing==true)and(countDown()==false)do
local humans = countPlayersInTeam(hum_team)
local zombies = countPlayersInTeam(zom_team)
if(minutes==9)and(seconds==59)then
stage.Value = 2
displayMsg("FAST zombie is NOW UNLOCKED! say '/fastzombie' to become a fast zombie!")
delay(10,removeMsg)
elseif(minutes==4)and(seconds==59)then
stage.Value = 3
displayMsg("KamiZombie is NOW UNLOCKED! say '/kamizombie' to become a kamizombie!")
delay(10,removeMsg)
elseif(minutes==7)and(seconds==25)then
stage.Value = 4
displayMsg("Ghost ZOMBIE is NOW UNLOCKED! say '/ghostzombie' to become a Ghost!")
delay(10,removeMsg)
elseif(minutes==6)and(seconds==25)then
stage.Value = 5
displayMsg("Fast GHOST Zombie is NOW UNLOCKED! say '/fastghostzombie' to become a FastGhostzombie!")
delay(10,removeMsg)
elseif(minutes==2)and(seconds==25)then
stage.Value = 6
displayMsg("ZOMBIE BOSS is NOW UNLOCKED! say '/zombieboss' to become a BOSS!")
delay(10,removeMsg)
end
if(seconds<10)then
displayHint("Humans left: "..humans.." | Time left: "..minutes..":0"..seconds.." | Zombies: "..zombies)
else
displayHint("Humans left: "..humans.." | Time left: "..minutes..":"..seconds.." | Zombies: "..zombies)
end
if(zombies==0)then -- Zombies left the game? Try to assign another to keep the game running!
if(countPlayers()>=2)then
if(countPlayers()<=3)then
assignZombies(1)
elseif(countPlayers()<=6)then
assignZombies(2)
else
assignZombies(3)
end
else
interrupted = true
break
end
end
if(humans==0)then
break
end
wait(1)
end
stage.Value = 1
removeHint()
if(interrupted==true)then
displayMsg("There are not enough players to continue the game...")
else
if(playing==false)then
displayMsg("YES! Huamns HAVE WON AND SURVIVED THE ZOMBIES! WOOT!")
game.Workspace.SENSATIONAL:play()
else
displayMsg("THERE IS NO HUMANS LEFT HUMANITY IS DEAD! NO!")
game.Workspace.freshmeat:play()
end
end
is_playing.Value = false
killPlayers()
wait(5)
resetPlayers()
removeMsg()
end
while true do
wait(3)
resetPlayers()
if(countPlayers()>=2)then
removeMsg()
playZombies()
else
displayMsg("There are not enough players to continue the game...")
end
end
COMMUNITY QUESTION
How to make players move back to lobby in this script?
1 answer
For a single player just do
game:GetService("TeleportService"):Teleport(placeid, playertobetpd) --Replace placeid to the lobby id and playertobetpd is just self explanitory.
For all players do
for i, v in pairs(game.Players:GetPlayers()) do --you can replace game.Players:GetPlayers() to a table of a less amount players instead of a table of all of the players, too.
game:GetService("TeleportService"):Teleport(placeid, v)
end
Just put these wherever you want it to be triggered. If you don't want them to be teleported to another place, then just remove their characters and make a gui visible or something similar.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
I see you are using a free script... This isn't a request site by the way
This aint a free script LOL XDD nobody else accept 2 people have this script it's me and jared2valdez4
still just using somebody else's script
Stop username, he has -12 rep. You don't need to scold him.