So basically, I made a round system and everything works except for the teleportAllPlayers part. It is supposed to teleport the players to the map and change their Playing value to 1. I tried to fix it but it won't budge, so I was wondering if anyone could help. Thank you if you try!

teleportAllPlayers:

function teleportAllPlayers()
	local mapSpawn = CFrame.new(workspace.mapClone.Spawns.Spawn.Position)
	for i, player in ipairs(game.Players:GetChildren()) do
		player.Character.Torso.CFrame = mapSpawn + Vector3.new(0, i * 5, 0)
		player.Playing.Value = 1
	end
end

Round System:

function playerNotification(changeText)
	for _,v in pairs (game.Players:GetChildren()) do
		local gameInterface = v.PlayerGui:FindFirstChild("GameInterface")
		if gameInterface then
			gameInterface.TopBar.Background.Notifications.Text = changeText
		end
	end
end

function waitForPlayers()
	while game.Players.NumPlayers < 2 do
		playerNotification("You need 1 more player to start the round!")
		wait(0)
	end
end

function intermissionTimer()
	if game.Players.NumPlayers >= 2 then
		for countDown = 10, 0, -1 do
			playerNotification("Intermission: " ..countDown)
			wait(1)
		end
	end
end

function displayGamemode()
	
end

function mapSelection()
	local mapList = game.ReplicatedStorage.CS_ReplicatedStorage.CS_Maps.Maps:GetChildren()
	local randomMap = math.random(1, #mapList)
	playerNotification("Choosing the map!")
	wait(4)
	local mapChosen = mapList[randomMap]
	playerNotification("The map is: " ..mapChosen.Name)
	mapClone = mapChosen:Clone()
	mapClone.Parent = game.Workspace
end

function teleportAllPlayers()
	local mapSpawn = CFrame.new(workspace.mapClone.Spawns.Spawn.Position)
	for i, player in ipairs(game.Players:GetChildren()) do
		player.Character.Torso.CFrame = mapSpawn + Vector3.new(0, i * 5, 0)
		player.Playing.Value = 1
	end
end

function startTimer()
	for countDown = 3, 0, -1 do
		playerNotification("Game begins in: " ..countDown)
		wait(1)
	end
end

function roundTimer()
	for countDown = 20, 0, -1 do
		playerNotification("Time left: " ..countDown)
		wait(1)
	end
end

function roundEnded()
	playerNotification("The round has ended!")
end

function teleportAlivePlayers()
	local mapSpawn = CFrame.new(workspace.SpawnLocation.Position)
	for i, player in ipairs(game.Players:GetChildren()) do
		player.Character.Torso.CFrame = mapSpawn + Vector3.new(0, i * 5, 0)
		player.Playing.Value = 1
	end
end

function mapDestroy()
	if mapClone.Parent == game.Workspace then
		mapClone:Destroy()
	end
end

function showResults()
	
end

game:GetService('Players').PlayerAdded:connect(function(Player)
	Player.CharacterAdded:connect(function(Character)
		Character:FindFirstChild("Humanoid").Died:connect(function()
			Player.Playing.Value = 0
		end)
	end)
	
	local Playing = Instance.new("IntValue", Player)
	Playing.Value = 0
	Playing.Name = "Playing"
end)

while true do
	waitForPlayers()
	wait(0)
	intermissionTimer()
	wait(0)
	displayGamemode()
	wait(5)
	mapSelection()
	wait(5)
	teleportAllPlayers()
	wait(0)
	startTimer()
	wait(0)
	roundTimer()
	wait(0)
	roundEnded()
	wait(0)
	teleportAlivePlayers()
	wait(0)
	mapDestroy()
	wait(0)
	showResults()
end

3 comments

0

You're the one who should be saying if there are any errors. Read the output.

0

I checked it and it says nothing.

0

Use print()s to find where the script stops.