Will this script work? Also, how do you do a function type thing where it waits until only 1 person is on the Bright Blue team, and then changes his/her team, re-spawns everyone, and shows a GUI to the winner saying "You won!" The GUI is located in Starter Gui under a frame called "winner"

StarterGui.ScreenGui.Map1.Visible = Map1
player = game.Players:GetChildren() --you might want to change this...
target1 = Vector3.new(-7, 9.8, -4) --...and this
target2 = Vector3.new(56, 25.8, 0.5)

repeat
wait(5)
function setTeam(player, teamName)
    player.TeamColor = game.Teams["In the Blitz"].TeamColor
    if player.Character then --Just in case the character doesn't exist for some reason
        player.Character:BreakJoints() -- Kills the players' character
    end
end

--How it's used
setTeam(game.Players.anth4598, "Blues")

--Changing everyone's team to "Reds"
for _, player in pairs(game.Players:GetPlayers()) do
    setTeam(player, "Bright blue")
end

function fadeTo(a, b, c)
	for transparency = a, b, c do
	--go from a to b, counting by c

		for _, part in pairs(player.Character:GetChildren()) do
		--for each of the objects in the character,

			if part:IsA("BasePart") then
			--check if it's a part, and if so

				part.Transparency = transparency
				--set its transparency
			end
		end
		wait(0.1)
	end
end

fadeTo(0, 1, 0.1) --fade out,
player.Character.Torso.CFrame = target1 --teleport the player
fadeTo(1, 0, -0.1) --fade back in
wait(10)
function setTeam(player, teamName)
    player.TeamColor = game.Teams["Lobby"].TeamColor
    if player.Character then --Just in case the character doesn't exist for some reason
        player.Character:BreakJoints() -- Kills the players' character
    end
end

--How it's used
setTeam(game.Players.anth4598, "Teamcolor")

--Changing everyone's team to "Reds"
for _, player in pairs(game.Players:GetPlayers()) do
    setTeam(player, "Bright blue")
end
wait(1)

until 2+6==4 

1 comment

0

No one is going to read the whole thing...