I made a script that works fine in play mode but not in test due to F.E., but I don't understand why. Can anybody tell me why/help me fix it?

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

local function round()
	if script.Mode.Value == "Preperation" then
	for i,v in pairs(game.Workspace.Votes: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 = modes[math.random(1,#modes)]
	local Mode2 = modes[math.random(1,#modes)]
	local Mode3 = modes[math.random(1,#modes)]
	repeat
		Map2 = math.random(1,#maps)
	until Map2 ~= Map1
	repeat
		Map3 = math.random(1,#maps)
	until Map3 ~= Map1 and Map3 ~= Map2
	game.ReplicatedStorage.Ready:FireAllClients(Mode1, Mode2, Mode3, Map1, Map2, Map3)
	end
	end
script.Mode.Changed:connect(function()
	round()
end)
wait(1)
script.Mode.Value = "Preperation"

5 comments

0

Is this a Server script or Local script?

0

Server script in workspace

0

What is the script supposed to do? It isn't clear.

0

It is supposed to put all the players in the ServerStorage, so they don't fall in the void, then select 3 gamemodes to go with 3 different maps then send them to player to get a vote gui. Problem is, it doesn't even run the first part.

0

Also no errors are shown in the output.