Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I make something that changes one team to another team using a script?

this is the gamescript;

while true do
	wait(25)
	function getteams()
wait(10)
	c=game.Players:children()
	for i=1, #c do
            if c[i].TeamColor==BrickColor.new(23) then
				   c[i].Character.Torso.CFrame = CFrame.new(Vector3.new(65.999,5.5,33.503))
				wait(10)
            elseif c[i].TeamColor==BrickColor.new(21) then
				   c[i].Character.Torso.CFrame = CFrame.new(Vector3.new(64.001,15.5,-61.497))
            end
time = 30--Change to how many seconds you want.
local h = Instance.new("Hint")
h.Parent = game.Workspace

while time > 0 do
time = time -1
h.Text = "There are"..time.." seconds until the next round!"
wait(1)
game.Workspace.Map1:Destroy()
map2 = game.Lighting.Map2:clone()
map2.Parent = Workspace

   end
end

game.Players.PlayerAdded:connect(getteams)
end

1 answer

It looks like your script does this correctly along with some other things as well. I simplified the team changing script down for you so that it is easier to read and modify:

local originalTeamColor = BrickColor.new("Bright blue") -- Old TeamColor
local newTeamColor = BrickColor.new("Bright red") -- New TeamColor

for _, player in ipairs (game.Players:GetChildren()) do
	if player.TeamColor == originalTeamColor then
		player.TeamColor = newTeamColor
	end
end

From here you can add on the extras you want.

This discussion is preserved as it was. New answers, comments, and votes are closed.