Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Trying to put all players on a team into a different one. but no error?

Asked by
Galicate 106
5 years ago

there are no errors at all to tell me what is wrong. I don't know what to do.

local Spectators = game:GetService("Teams").Spectating:GetPlayers()
while true do
    wait(5)
    print("Checking")
    for i = 1, #Spectators do
        Spectators[i].TeamColor = game:GetService("Teams").MTF.TeamColor
        Spectators[i]:LoadCharacter()
        print(#Spectators)
    end
    wait(150)
    for i = 1, #Spectators do
        Spectators[i].TeamColor = game:GetService("Teams").Chaos.TeamColor
        Spectators[i]:LoadCharacter()
        print(#Spectators)
    end
end

1 answer

Log in to vote
-1
Answered by 5 years ago

You need to set the player's Team as well as their TeamColor.

-- ...
Spectators[i].TeamColor = game:GetService("Teams").MTF.TeamColor
Spectators[i].Team = game:GetService("Teams").MTF
-- ...
Ad

Answer this question