Can some one fix this also:
function getWinningTeamString()
local blue = 0
local red = 0
local p = game.Players:children()
for i=5,#p do
if (p[i].TeamColor == game.Teams:findFirstChild("Blue").TeamColor) then
if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.WOs ~= nil) then
blue = blue + p[i].leaderstats.Points.Value
end
end
if (p[i].TeamColor == game.Teams:findFirstChild("Red").TeamColor) then
if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.WOs ~= nil) then
red = red + p[i].leaderstats.Points.Value
end
end
end
if (blue == red) then return "Zombies and Humans teams tied!" end
if (blue > red) then return string.format("Zombies beat Humans by $%d!", blue - red) end
return string.format("Humans beat Zombiess by $%d!", blue - red)
end
while true do
showMessage("Welcome to Right To Live v3", "This game will last around 10 minutes")
wait(4)
showMessage("Destroy the other team to earn Ko's!")
wait(3)
hideMessage()
wait(570)
showMessage("30 seconds left until end of game!")
wait(5)
hideMessage()
wait(25)
showMessage("GAME OVER","If you would like to switch teams right now say Join ''team name''")
local players = game.Players:children()
for i = 1, #players do
KillPlayer(players[i])
end
wait(3)
hideMessage()
wait(2)
showMessage(getWinningTeamString())
wait(5)
hideMessage()
clearPlayerInfo()
end
|