Having problems with a round script I am working on, to switch rounds and stuff, this is what I have so far:

local modes = {"Infection", "Juggernaught", "Dominance"}

local function round()
	if script.Mode.Value == "Preperation" then
	for i,v in pairs(game.Players:GetChildren()) do
		game.Workspace[v.Name].Parent = game.ServerStorage
	end
	local maps = game.Lighting.Maps:GetChildren()
	local Map1 = math.random(1,#maps)
	local Map2 = math.random(1,#maps)
	local Map3 = math.random(1,#maps)
	local Mode1 = math.random(1,#modes)
	local Mode2 = math.random(1,#modes)
	local Mode3 = math.random(1,#modes)
	repeat
		Map2 = math.random(1,#maps)
	until Map2 ~= Map1
	repeat
		Map3 = math.random(1,#maps)
	until Map3 ~= Map1 and Map3 ~= Map1
	for i,v in pairs(game.Players:GetChildren()) do -- skips this loop
		game.Players[v.Name]:FindFirstChild("Ready"):FireClient(v, Mode1, Mode2, Mode3, Map1, Map2, Map3)
	end
	end
	end

script.Mode.Changed:connect(function()
	round()
end)
script.Mode.Value = "Preperation"

It skips the for loop at the end, and I don't know why. The game is F.E., can anybody help?

5 comments

0

I believe your error comes from line 20. You seem to be checking that Map3 is not equal to Map1 twice. Did you mean to do this?

0

Thank you for pointing that out, but no, that isn't the problem. It just skips the for loop entirely and goes to the end, I tried printing "Fired" in the loop then "Finished" after it, but it just printed finished so I know it's working, the for just isn't running. Also, no error in the output.

0

Try putting a breakpoint on the line. By this, I mean go to the left of the code and click the grey space. A red circle should appear. Just run the game and see if anything happens.

0

Nothing happens.