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

How would I change all players from one team to another?

Hi! Basically, I'm trying to make an intermission script that'll take all players from the 'Lobby' Team into the 'Playing' Team, but I'm not quite sure how to do that.

Below is a little snippet of the code for reference:

while rep.StartGame.Value == false do 
	repeat
		wait(1)
	until rep.StartGame.Value == true do 
	print ("GAME STARTING")
	-- CHANGE PLAYERS' TEAM

What would be the easiest and most efficient way to transfer all players into the other team? Thank you!

1 answer

✓ Accepted answer
for i,v in pairs(game:GetService("Players"):GetChildren()) do
	if(v.Team.Name == "Lobby") then
		v.Team = game.Teams.Playing
	end
end

I'm not certain if this works as I didn't test it, if there are any issues let me know.

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