I checked the script a ton of times and i can't find the error. Also keep going down until you see a message please. Please help. Thank you. And yes I use Alvin Blox turorial.

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() -- Table of all the map models
	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 ("i:i"):format(s/60%60, s%60)
end

---------This is where it does not work (below)-----

function module.StartRound(length,piggy,chapterMap) -- length (in seconds)
	
	local outcome
	
	for i = length,0,-1 do
		
		if i == (length - 20) then
			module.TeleportPlayers({piggy},chapterMap.PlayerSpawns:GetChildren())
			status.Value = "Darkness has rised."
			wait(2)
		end
		
		local contestants = {}
		
		local isPiggyHere = false
		
		for i, player in pairs(game.Players:GetPlayers()) do
			
			if player:FindFirstChild("Contestant") then
				table.insert(contestants,player)
			elseif player:FindFirstChild("Piggy") then
				isPiggyHere = true
			end
			
		end
		
		if not isPiggyHere then -- if isPiggyHere == false / is the piggy dead / left the game?
			outcome = "darkness-faded"
			break
		end
		
		if #contestants == 0 then
			outcome = "darkness-took-everyone"
			break
		end
		
		if i == 0 then
			outcome = "time-up"
			break
		end
		
		status.Value = toMS(i)
		wait(1)
	end
	
	if outcome == "darkness-took-everyone" then
		status.Value = "Darkness Overtook Everyone"
	elseif outcome == "time-up" then
		status.Value = "Everyone Stands, No One Wins"
	elseif outcome == "darkness-faded" then
		status.Value = "Darkness Faded By Itself, Light Wins"
	end
	
	
	
	wait(5) -- Time that message stays
	
end

return module

3 comments

0

are you calling it anyways?

0

yes

0

God, this is a disgrace to MiniToon's work. AlvinBlox is not a reliable source