Module Issue: Requested module experienced an error while loading

So Im following AlvinBlox’s tutorial on How To Make A Piggy Game for a learning experience to hopefully become better at scripting. And I get the issue in the output Requested module experienced an error while loading. I don’t know if this issue is on roblox’s fault or mine but the game was working perfectly until this issue happened out of complete nowhere. Help is appreciated.

The Module Script is called RoundModule which relates to the GameLogic script.
Problem in the RoundModule:

local module = {}

local status = game.ReplicatedStorage:WaitForChild("Status")

function module.Intermission(length)
	for i = length,0,-1 do
		status.Value = "Next round starts in "..i.." seconds"
		wait(1)
	end
end

function module.SelectChapter()
	local rand = Random.new()
	local chapters = game.ReplicatedStorage.Chapters:GetChildren()
	local chosenChapter = chapters[rand:NextInteger(1,#chapters)]
	
	return chosenChapter
end

function module.ChoosePiggy(players)
	
	local RandomObj = Random.new()
	
	local chosenPiggy = players[RandomObj:NextInteger(1,#players)]
	
	return chosenPiggy
	
end

function module.DressPiggy(piggy)
	local character = game.ServerStorage.Piggy:Clone()
	character.Name = piggy.Name
	
	piggy.Character = character
	
	character.Parent = workspace
end

function module.TeleportPiggy(player)
	if player.Character then
		
		player.Character.Humanoid.WalkSpeed = 14
		
		local bat = game.ServerStorage.Tools.PiggyBat:Clone()
		bat.Parent = player.Character
		
		if player.Character:FindFirstChild("HumanoidRootPart") then
			player.Character.HumanoidRootPart.CFrame = game.Workspace.WaitingRoom.PiggyWaitingSpawn.CFrame + Vector3.new(0,5,0)
		end
		
	end
end

function module.TeleportPlayers(players, mapSpawns)
	for i, player in pairs(players) do
		if player.Character then
			local character = player.Character
			
			if character:FindFirstChild("HumanoidRootPart") then
				
				player.Character.Humanoid.WalkSpeed = 16
				
				local rand = Random.new()
				player.Character.HumanoidRootPart.CFrame = mapSpawns[rand:NextInteger(1,#mapSpawns)].CFrame + Vector3.new(0,10,0)
				
			end
		end
	end
	
end

function module.InsertTag(contestants,tagName)
	for i, player in pairs(contestants) do
		local Tag = Instance.new("StringValue")
		Tag.Name = tagName
		Tag.Parent = player
	end
end

local function toMS(s)
    return ("%02i:%02i"):format(s/60%60, s%60)
end

function module.StartRound(length,piggy,chapterMap)
	
	for i = length,0, -1 do
		
		if i == (length - 20) then
			module.TeleportPlayers({piggy},chapterMap.PlayerSpawns:GetChildren())
			status.Value = "Piggy has woken up!"
			wait(2)
		end
		
		local contestants = {}
		
		local isPiggyHere = false
		
		for i, player in pairs(game.Players:GetPlayers()) do
			
			if player:FindFirstChild("Contestants") then
				table.insert(contestants,player)
			else if playerFindFirstChild("Piggy") then
			end
			
		end
		
		status.Value = toMS(i)
		wait(1)
	end
	
end

return module
1 Like

The error occurs when the code within the required ModuleScript errors, would be handy if you supplied the ModuleScripts’s code.

Make sure to do some debugging with prints inside the ModuleScript to determine where and where it doesn’t reach. This will help tremendously.

I will make edits to the post and add the RoundModule script to the post if required

Edit: The other module’s scripts within the GameLogic are long I don’t think I need to put them?

that happens in hd admin’s btools too

  1. Don’t bump the topic four months ago.
  2. This question has nothing to do with this topic.
1 Like

ok im sorry its because im new