Script Broken, freezes game

Hi!
My scripter left my group at the worst passible time, when their script was broken.
It now just freezes the game.
Code:

function module.ChooseMiniGame()
	if not debounce then
		debounce = true
		local RandomGame = Gamemodes[math.random(1, #Gamemodes)]
		if RandomGame then
			local Map = RandomGame:Clone()
			Map.Parent = workspace
			Map.Name = "RoundMap"
			game.ReplicatedStorage:WaitForChild("EventHandlerRemote"):FireAllClients(Map.Name)
			module.Start4Blocks(Map.Name)
		end
		wait(7)
		debounce = false
	end
end

What happened here?
NOTE: The game is frozed in this photo.

What does the EventHandlerRemote does when it’s fired?

Not sure. The person that quit said they were in the middle of rescriptuing when they quit, so here is the full:

local module = {}

local AlivePlayers = {}

local MiniGames = {"4Blocks","6Blocks"}

local Gamemodes = game.ReplicatedStorage:WaitForChild("Gamemodes"):GetChildren()

local MapStars = {
	["4Blocks"] = 4, -- Amount
	["6Blocks"] = 2,
}

local debounce = false

function module.Stars(Map)
	for i, Star in pairs(MapStars) do
		return MapStars
	end
end

function module.ChooseMiniGame()
	if not debounce then
		debounce = true
		local RandomGame = Gamemodes[math.random(1, #Gamemodes)]
		if RandomGame then
			local Map = RandomGame:Clone()
			Map.Parent = workspace
			Map.Name = "RoundMap"
			game.ReplicatedStorage:WaitForChild("EventHandlerRemote"):FireAllClients(Map.Name)
			module.Start4Blocks(Map.Name)
		end
		wait(7)
		debounce = false
	end
end

function module.DeSpawnBlocks()
	local EventFolder = game.Workspace:FindFirstChild("RoundMap")
	if EventFolder then
		game.Debris:AddItem(EventFolder,1)
	elseif not EventFolder then
		module.ChooseMiniGame()
	end
	wait(5)
	module.ChooseMiniGame()
end

function module.Start4Blocks(GameName)
	for i, player in pairs(game.Players:GetPlayers()) do
		local HumaniodRootPart = player.Character:FindFirstChild("HumanoidRootPart")
		if HumaniodRootPart then
			HumaniodRootPart.Anchored = true
			HumaniodRootPart.CFrame = CFrame.new(game.Workspace:FindFirstChild("EventFolder"):FindFirstChild("SpawnPart").Position) + Vector3.new(0,10,0)
			wait(3)
			HumaniodRootPart.Anchored = false
		else
			local Torso = player.Character:FindFirstChild("Torso")
			if Torso then
				Torso.Anchored = true
				Torso.CFrame = CFrame.new(game.Workspace:FindFirstChild("EventFolder"):FindFirstChild("SpawnPart").Position) + Vector3.new(0,10,0)
				wait()
				Torso.Anchored = false
			end
		end
	end
end

function module.Start6Blocks()

end

function module.EndRound()

end

function module.RemovePlayer(player)
	if AlivePlayers[player] then
		table.remove(AlivePlayers,player)
		AlivePlayers[player] = nil
	end
end

function module.AddPlayer(player)
	table.insert(AlivePlayers,player)
	print("Working")
end

return module

Okay. Do you have any error in the console when the game freezes?

Hello there! It may not be in this script. If it causes the game to freeze then I would check for viruses. You can do so by using the script searching feature. I would check for the following words.

require()
Kick()

If there is no virus then please respond, I think I have another idea as to why.

There is no virus.


@Sandessat


It is no longer freezing. I wonder if I changed somethinfg/

Alright, if it is no longer freezing then that’s good.

It is still not picking it. Something to do with ChooseMiniGame

read above message dont know if you sawe it

I need to see the script. Along with the line numbers.

local module = {}

local AlivePlayers = {}

local MiniGames = {“4Blocks”,“6Blocks”}

local Gamemodes = game.ReplicatedStorage:WaitForChild(“Gamemodes”):GetChildren()

local MapStars = {
[“4Blocks”] = 4, – Amount
[“6Blocks”] = 2,
}

local debounce = false

function module.Stars(Map)
for i, Star in pairs(MapStars) do
return MapStars
end
end

function module.ChooseMiniGame()
if not debounce then
debounce = true
local RandomGame = Gamemodes[math.random(1, #Gamemodes)]
if RandomGame then
local Map = RandomGame:Clone()
Map.Parent = workspace
Map.Name = “RoundMap”
game.ReplicatedStorage:WaitForChild(“EventHandlerRemote”):FireAllClients(Map.Name)
module.Start4Blocks(Map.Name)
end
wait(7)
debounce = false
end
end

function module.DeSpawnBlocks()
local EventFolder = game.Workspace:FindFirstChild(“RoundMap”)
if EventFolder then
game.Debris:AddItem(EventFolder,1)
elseif not EventFolder then
module.ChooseMiniGame()
end
wait(5)
module.ChooseMiniGame()
end

function module.Start4Blocks(GameName)
for i, player in pairs(game.Players:GetPlayers()) do
local HumaniodRootPart = player.Character:FindFirstChild(“HumanoidRootPart”)
if HumaniodRootPart then
HumaniodRootPart.Anchored = true
HumaniodRootPart.CFrame = CFrame.new(game.Workspace:FindFirstChild(“EventFolder”):FindFirstChild(“SpawnPart”).Position) + Vector3.new(0,10,0)
wait(3)
HumaniodRootPart.Anchored = false
else
local Torso = player.Character:FindFirstChild(“Torso”)
if Torso then
Torso.Anchored = true
Torso.CFrame = CFrame.new(game.Workspace:FindFirstChild(“EventFolder”):FindFirstChild(“SpawnPart”).Position) + Vector3.new(0,10,0)
wait()
Torso.Anchored = false
end
end
end
end

function module.Start6Blocks()

end

function module.EndRound()

end

function module.RemovePlayer(player)
if AlivePlayers[player] then
table.remove(AlivePlayers,player)
AlivePlayers[player] = nil
end
end

function module.AddPlayer(player)
table.insert(AlivePlayers,player)
print(“Working”)
end

return module