This script is a game round countdown. When the time hits zero, it is supposed to team everyone that is a Fighter to the Fallen team. When this happens, it only does it to one person and everyone else stays a fighter. Any ideas why?
for i = 20,0,-1 do
wait(1.2)
text = "Time left in round: ".. i
game.ReplicatedStorage.cd:FireAllClients(text, i)
if i == 0
then
game.Workspace.songg.SoundId = "http://www.roblox.com/asset/?id=1839666799"
game.Workspace.songg:Play()
for i,v in pairs(game.Teams.Fighters:GetPlayers()) do
v.TeamColor = BrickColor.new("Really red")
v:LoadCharacter()
wait(1)
text = "The round did not finish in time so a random winner will now be chosen!"
game.ReplicatedStorage.ann:FireAllClients(text)
wait(5)
game.Workspace.map:Destroy()
local persons = game.Teams.Fallen:GetPlayers()
local person = persons[math.random(1,#persons)].Name
game.ReplicatedStorage.winner.Value = person
winner = game.ReplicatedStorage.winner.Value
wait(1)
text = "The winner is..."
game.ReplicatedStorage.ann:FireAllClients(text)
wait(5.2)
text = winner.."!"
game.ReplicatedStorage.ann:FireAllClients(text)
wait(5)
game.ServerScriptService.choose.Disabled = false
script.Disabled = true
end end end
Here is the part that is supposed to do the teaming:
for i,v in pairs(game.Teams.Fighters:GetPlayers()) do
v.TeamColor = BrickColor.new("Really red")
v:LoadCharacter()
wait(1)
