How to fix this Round system?


Look i have some errors, i followed a yt vid how to do it but idk how t ofix it now, can someone help me? Look at the script i send image too. It should start a round and teleport to the game mode but it doesn’t

– Variables

local Lobby = game.Workspace.Lobby
local Maps = game.ReplicatedStorage.Maps:GetChildren()
local Status = game.ReplicatedStorage.Status

– Game Loop

while true do

-- Intermission

for i = 10, 0, -1 do
	Status.Value = "Intermissions: "..i
	task.wait(1)
end


-- Map Selector

local ChosenMap = Maps[math.random(1, #Maps)]
local ClonedMap = ChosenMap:Clone()

ClonedMap.Parent = game.Workspace
Status.Value ="Map: "..ClonedMap.Name

task.wait(3)

-- Teleports to map

for i, Players in pairs(game.Players:GetPlayers()) do
	
	local Character = Player.Character
	
	if Character then
		
		local HumanoidRootPart = Character.HumanoidRootPart
		
		HumanoidRootPart.CFrame = ClonedMap.TeleportPoint.CFrame
	end
end


-- Game Time

for i = 10,0,-1 do
	Status.Value = "Game: "..i
	task.wait(1)
end

end

-- Teleports to Lobby

for i, Player in pairs(game.Players:GetPlayers()) do
	
	local Character = Player.Character
	
	if Character then
		
		local HumanoidRootPart = Character.HumanoidRootPart
		
		HumanoidRootPart.CFrame = Lobby.TeleportPoint.CFrame
	end
end

-- Destroys Map

ClonedMap: Destroy()

end

2 Likes

Remove the extra end at the bottom of the script.

1 Like

oh alr let me test it i will text back if it works

eh i removed the end, the timer starts counting but i don’t get teleported to the place

Here I assume you meant for i, Player in pairs
The character you are grabbing is from the variable player while you’re looping over a variable named Players plural

what do i have to change in that scripts? Sorry i’m bad at scripting

You added an extra s in Player.

Code:

local Lobby = game.Workspace.Lobby
local Maps = game.ReplicatedStorage.Maps:GetChildren()
local Status = game.ReplicatedStorage.Status

while true do
	-- Intermission

	for i = 10, 0, -1 do
		Status.Value = "Intermissions: "..i
		task.wait(1)
	end


	-- Map Selector

	local ChosenMap = Maps[math.random(1, #Maps)]
	
	local ClonedMap = ChosenMap:Clone()
	ClonedMap.Parent = workspace
	
	Status.Value ="Map: ".. ClonedMap.Name

	task.wait(3)

	-- Teleports to map

	for i, Player in pairs(game.Players:GetPlayers()) do
		local Character = Player.Character

		if Character then
			Character:PivotTo(ClonedMap.TeleportPoint.CFrame)
		end
	end


	-- Game Time

	for i = 10,0,-1 do
		Status.Value = "Game: "..i
		task.wait(1)
	end

	-- Teleports to Lobby

	for i, Player in pairs(game.Players:GetPlayers()) do
		local Character = Player.Character

		if Character then
			Character:PivotTo(Lobby.TeleportPoint.CFrame)
		end
	end

	-- Destroys Map
	ClonedMap:Destroy()
end
1 Like