Line Runner Template Not Loading

The Line Runner Template will not load after modifying the path parts.

After changing/adding parts or adding scripts to the paths the game will not load correctly and the game will appear empty.

Here’s the error that it gives: ServerScriptService.Server_Main:60: End is not a valid member of Model "ReplicatedStorage.PathModules.Path"

local path = nil
coroutine.wrap(function() path = require(script.PathCreator) end)()

-- Handle remote functions/events
function runStarting(player)
	if player.Character then
		if player.Character:FindFirstChild("FastStartScript") then
			player.Character.FastStartScript.Disabled = false
		end
	end
end
game.ReplicatedStorage.RemoteEvents.RunStarting.OnServerEvent:connect(runStarting)

local behaviourModules = {}

coroutine.wrap(function()
	for _, behaviourScript in ipairs(script.Behaviours:GetChildren()) do
		local success, errMessage = pcall(function() 
			behaviourModules[behaviourScript.Name] = require(behaviourScript) 
		end)
		if not success then
			warn("Failed to load module" ..behaviourScript.Name.. ".\n" ..errMessage)
		end
	end
end)()

function executeBehaviour(player, character, brickTouched, behaviourName)
	if behaviourModules[behaviourName] ~= nil then
		behaviourModules[behaviourName]:ExecuteBehaviour(brickTouched, character)
	end
end
game.ReplicatedStorage.RemoteEvents.ExecuteBehaviour.OnServerEvent:connect(executeBehaviour)

-- Initialization
local lastActivePath = {}

if game.Workspace:FindFirstChild("BasePlate") then
	game.Workspace.BasePlate:Destroy()
end

local tracksModel = Instance.new("Model")
tracksModel.Name = "Tracks"
tracksModel.Parent = game.Workspace

function packagePathModels()
	local pathPackager = require(script.PathPackager) 
	while true do
		local pathBase = game.Workspace:FindFirstChild("PathBase", true)
		if pathBase then
			pathPackager:PackageRoom(pathBase)
		else
			break
		end
	end
end
--Error here
coroutine.wrap(function() packagePathModels() end)()

-- Leaderboard
function loadLeaderstats(player)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"

	local highScore = Instance.new("IntValue")
	highScore.Name = "High Score"
	highScore.Parent = stats
	highScore.Value = 0

	local currentScore = Instance.new("IntValue")
	currentScore.Name = "Score"
	currentScore.Parent = stats
	
	stats.Parent = player
end

function initialiseRunStats(player)
	if player:FindFirstChild("RunStats") then
		player.RunStats.Distance.Value = 0
		player.RunStats.CoinsCollected.Value = 0
	end
end

function showResults(player)
	local resultsGUI = game.ServerStorage.GUIs.PostRunGUI:Clone()
	resultsGUI.Frame.DistanceValue.Text = player.RunStats.Distance.Value
	resultsGUI.Frame.CoinsValue.Text = player.RunStats.CoinsCollected.Value
	resultsGUI.Frame.ScoreValue.Text = player.leaderstats.Score.Value

	resultsGUI.Parent = player.PlayerGui
	return resultsGUI
end

function initialiseNewRun(player, delayTime, charExpected, showLastResults)
	if not path then
		while not path do
			wait()
		end
	end

	local lastResultsGUI = nil
	if showLastResults then
		lastResultsGUI = showResults(player)
	end

	if delayTime ~= 0 then
		wait(delayTime)
	end	
	
	if lastResultsGUI ~= nil then
		lastResultsGUI:Destroy()
	end

	if player and player.Parent then
		-- charExpected is needed to avoid calling LoadCharacter on players leaving the game
		if player.Character or charExpected == false then
			player:LoadCharacter()
			
			initialiseRunStats(player)
			
			local playersPath = path()
			lastActivePath[player.Name] = playersPath
			playersPath:init(player.Name)
		end
	end
end

function setUpPostRunStats(player)
	local folder = Instance.new("Folder")
	folder.Name = "RunStats"
	folder.Parent = player
	local currentDistance = Instance.new("IntValue")
	currentDistance.Name = "Distance"
	currentDistance.Value = 0
	currentDistance.Parent = folder
	local coinsCollected = Instance.new("IntValue")
	coinsCollected.Name = "CoinsCollected"
	coinsCollected.Value = 0
	coinsCollected.Parent = folder
end

function onPlayerEntered(player)	
	player.CharacterAdded:connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		if humanoid then
			humanoid.Died:connect(function()
				initialiseNewRun(player, 4, true, true)
			end)
		end
	end)
	
	-- Initial loading
	loadLeaderstats(player)	
	setUpPostRunStats(player)
	
	-- Start game
	initialiseNewRun(player, 0, false, false)
end
game.Players.PlayerAdded:connect(onPlayerEntered)

function onPlayerRemoving(player)	
	local track = game.Workspace.Tracks:FindFirstChild(player.Name)
	if track ~= nil then
		track:Destroy()
	end
end
game.Players.PlayerRemoving:connect(onPlayerRemoving)

for _, player in pairs(game.Players:GetChildren()) do
	onPlayerEntered(player)
end

2 Likes

Did you delete or re-name the end piece?

No, I didn’t do anything to the end piece

So, what exact did you modify about the line runner? Just like textures, or did you re- make most of the maps

It looks like you just changed the textures, so idk. Did you remove any of those red bricks at the ends of each map?

I see them there, but just checking

No, but the only thing I did was to change the Walkway of the Bridge and added a script that animates the water texture.

Normal


Mine Version

The Normal Version has a lot more stuff in the ReplicatedStorage.PathModules

The folders in PathModules are just where the script categorises path segments. The script appears to put segments in a model named “Path”, then it moves the models into PathModules before putting it into either Branch, GoingUp, GoingDown, or SameHeight.

I was able to recreate the same error by removing the red End part. Try checking all end parts again, also make sure they have anchored and archivable properties enabled. I don’t think its likely to be a script error if you haven’t modified any of them.


Has you can see all of the end pieces are there in the same place with same properties.

2 Likes

Maybe i am late but so far the problem has to be with the bridge section, if you move it to any other folder of roblox, for example: ReplicatedStorage, and playtest it for a few times the game will never break, what i found is that the end part in the bridge folder(when it is chosen to spawn first at least) will appear inside the parts folder instead of the bridge folder as it should.

1 Like

Ok so, i have the solution for you, go to the bridge Model and select all the parts and left only the “Collisionfixer” and “FixerTwo” unselected, then Union all the parts and on Properties tab go to CollisionFidelity and change it from Default to PreciseConvexDecomposition, this should fix the bug.

1 Like