Why wont the round repeat

I’m trying to make a round system, but the problem is it doesn’t loop. The round happens once and not again.
Main Script:

local Part1 = game.Workspace.Part1
local Part2 = game.Workspace.Part2
local Part3 = game.Workspace.Part3
local Part4 = game.Workspace.Part4
local Part5 = game.Workspace.Part5
local Part6 = game.Workspace.Part6
local Part7 = game.Workspace.Part7
local Part8 = game.Workspace.Part8
local Part9 = game.Workspace.Part9
local Part1Event = game.ReplicatedStorage.Part1Event
local Part2Event = game.ReplicatedStorage.Part2Event
local Part3Event = game.ReplicatedStorage.Part3Event
local Part4Event = game.ReplicatedStorage.Part4Event
local Part5Event = game.ReplicatedStorage.Part5Event
local Part6Event = game.ReplicatedStorage.Part6Event
local Part7Event = game.ReplicatedStorage.Part7Event
local Part8Event = game.ReplicatedStorage.Part8Event
local Part9Event = game.ReplicatedStorage.Part9Event
local StartEvent = game.ReplicatedStorage.StartEvent
local times = 3
local roundon = false
function teleport()
	for _, v in next, game.Players:GetPlayers() do
		v.Character.HumanoidRootPart.CFrame = CFrame.new(-19.647, 12.818, -0.045)
	end
end
function teleport2()
	for _, v in next, game.Players:GetPlayers() do
		v.Character.HumanoidRootPart.CFrame = CFrame.new(-13.997, 43.309, 4.796)
	end
end
while roundon == false do
	wait(5)
	teleport()
	roundon = true
	StartEvent:Fire()
	times = 3
end
while roundon == true and times > 0 do
	wait(5.2)
	local randompart = math.random(1,9)
	times = times - 1
	print(times)
	if randompart == 1 then
		Part1Event:Fire()
	elseif randompart == 2 then
		Part2Event:Fire()
	elseif randompart == 3 then	
		Part3Event:Fire()
	elseif randompart == 4 then	
		Part4Event:Fire()
	elseif randompart == 5 then	
		Part5Event:Fire()
	elseif randompart == 6 then	
		Part6Event:Fire()
	elseif randompart == 7 then	
		Part7Event:Fire()
	elseif randompart == 8 then
		Part8Event:Fire()
	elseif randompart == 9 then
		Part9Event:Fire()
	end
end
while times == 0 do
	wait()
	teleport2()
	roundon = false
	times = 3
end

And incase, the color changing script

local Part1 = game.Workspace.Part1
local Part2 = game.Workspace.Part2
local Part3 = game.Workspace.Part3
local Part4 = game.Workspace.Part4
local Part5 = game.Workspace.Part5
local Part6 = game.Workspace.Part6
local Part7 = game.Workspace.Part7
local Part8 = game.Workspace.Part8
local Part9 = game.Workspace.Part9
local Part1Event = game.ReplicatedStorage.Part1Event
local Part2Event = game.ReplicatedStorage.Part2Event
local Part3Event = game.ReplicatedStorage.Part3Event
local Part4Event = game.ReplicatedStorage.Part4Event
local Part5Event = game.ReplicatedStorage.Part5Event
local Part6Event = game.ReplicatedStorage.Part6Event
local Part7Event = game.ReplicatedStorage.Part7Event
local Part8Event = game.ReplicatedStorage.Part8Event
local Part9Event = game.ReplicatedStorage.Part9Event
function onPart1()
	script.Parent.BrickColor = BrickColor.new("Hot pink")
end
function onPart2()
	script.Parent.BrickColor = BrickColor.new("Really blue")
end
function onPart3()
	script.Parent.BrickColor = BrickColor.new("Deep orange")
end
function onPart4()
	script.Parent.BrickColor = BrickColor.new("New Yeller")
end
function onPart5()
	script.Parent.BrickColor = BrickColor.new("Black")
end
function onPart6()
	script.Parent.BrickColor = BrickColor.new("Magenta")
end
function onPart7()
	script.Parent.BrickColor = BrickColor.new("Lime green")
end
function onPart8()
	script.Parent.BrickColor = BrickColor.new("Bright red")
end
function onPart9()
	script.Parent.BrickColor = BrickColor.new("Institutional white")
end
Part1Event.Event:Connect(onPart1)
Part2Event.Event:Connect(onPart2)
Part3Event.Event:Connect(onPart3)
Part4Event.Event:Connect(onPart4)
Part5Event.Event:Connect(onPart5)
Part6Event.Event:Connect(onPart6)
Part7Event.Event:Connect(onPart7)
Part8Event.Event:Connect(onPart8)
Part9Event.Event:Connect(onPart9)

this line repeats until the roundon == false
just put a while true do on the top and an end at the bottom then it should repeat

2 Likes

would it be like this?

while true do
	wait(5.2)
	local randompart = math.random(1,9)
	times = times - 1
	print(times)
	if randompart == 1 then
		Part1Event:Fire()
	elseif randompart == 2 then
		Part2Event:Fire()
	elseif randompart == 3 then	
		Part3Event:Fire()
	elseif randompart == 4 then	
		Part4Event:Fire()
	elseif randompart == 5 then	
		Part5Event:Fire()
	elseif randompart == 6 then	
		Part6Event:Fire()
	elseif randompart == 7 then	
		Part7Event:Fire()
	elseif randompart == 8 then
		Part8Event:Fire()
	elseif randompart == 9 then
		Part9Event:Fire()
	end
end
while times == 0 do
	wait()
	teleport2()
	roundon = false
	times = 3
end

yeah i think its that it just loops everything

1 Like

Ok, so I changed it to this

while roundon == false do
	wait(5)
	teleport()
	roundon = true
	StartEvent:Fire()
	times = 3
end
while true do
	wait(5.2)
	local randompart = math.random(1,9)
	times = times - 1
	print(times)
	if randompart == 1 then
		Part1Event:Fire()
	elseif randompart == 2 then
		Part2Event:Fire()
	elseif randompart == 3 then	
		Part3Event:Fire()
	elseif randompart == 4 then	
		Part4Event:Fire()
	elseif randompart == 5 then	
		Part5Event:Fire()
	elseif randompart == 6 then	
		Part6Event:Fire()
	elseif randompart == 7 then	
		Part7Event:Fire()
	elseif randompart == 8 then
		Part8Event:Fire()
	elseif randompart == 9 then
		Part9Event:Fire()
	end
	if times == 0 then
	wait()
	teleport2()
	roundon = false
	times = 3
end
end

and it repeats, but now it just doesn’t teleport the player after the first round

I will create a new post for this but a different bug