Creating quest template, does not copy

I’m having major bugs with this, After i fire the server (on line 60) nothing happens. the function doesn’t work and it just thinks it ends the script after it fires the server

print("hey guyssyfuihewfiuhewfiuwf")
local explorer = workspace["QUEST NPCS"].Part
local player = game.Players.LocalPlayer
local beforegui = player.PlayerGui:WaitForChild("QuestDialouge")
local gui = beforegui:WaitForChild("QuestDialogue")

print("beforegui looolll")
local db = false
print("Hey guys whats up today so im going to say hello")
explorer.Touched:Connect(function()
	print("1")
	if not db then
		db = true
		print("2")
		beforegui.Enabled = true
		print("3")
	gui.NPCName.Text = "Part"
	local chatText = "Hey! I need you to explore this island for me, I need approximately 500 studs explored before I can uncover the mystery of this island, I hear theres a strange thing below here! Will you help me?"
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
			script.Parent.Parent.Sound:Play()
		end
		gui.Option1.Text = "Sure!"
		gui.Option2.Text = "Nope, I don't want to."
		gui.Option1.Visible = true
		gui.Option2.Visible = true
		print("4")
		db = false
	end
end)

gui.Option1.MouseButton1Click:Connect(function()
	gui.Option1.Visible = false
	gui.Option2.Visible = false
	local chatText = "Thanks man!"
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
		script.Parent.Parent.Sound:Play()
	end
    wait(3)
	beforegui.Enabled = false
	game.ReplicatedStorage.QuestRemotes.Walk500Studs.GiveQuest:FireServer()
	wait(1)
	lol()
end)

gui.Option2.MouseButton1Click:Connect(function()
	gui.Option1.Visible = false
	gui.Option2.Visible = false
	local chatText = "You don't want to? Well.. If you change your mind come to me, I'm waiting for you here."
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
		script.Parent.Parent.Sound:Play()
	end
	wait(2)
	beforegui.Enabled = false
	game.ReplicatedStorage.QuestRemotes.Walk500Studs.GiveQuest:FireServer()
	wait(1)
	lol()
end)

function lol()
	local pathfinder = player:WaitForChild("Quests"):WaitForChild("CurrentQuests"):WaitForChild("PathFinder")
	print("ok")
--[[	local scrollingframe = script.Parent.Parent.Parent:WaitForChild("QuestsFrame"):WaitForChild("QuestsScrollingFrame")
	local questtemp = script.Parent.Parent.Parent:WaitForChild("Handler"):WaitForChild("QuestTemplate")
	questtemp.Parent = scrollingframe
	questtemp.Visible = false ]]--
	local quest = script.Parent.Parent.Parent:WaitForChild("Handler"):WaitForChild("QuestTemplate"):Clone()
	print("ok2")
	quest.Parent = player.PlayerGui:WaitForChild("QuestProgressGui"):WaitForChild("QuestsFrame"):WaitForChild("QuestsScrollingFrame")
	print("ok3")
	quest.Name = "QuestTemplate"
	print("ok4")
	quest.Visible = true
	print("ok5")
	quest.QuestName.Text = pathfinder:WaitForChild("Quest").Value
	quest.QuestTask.Text = pathfinder:WaitForChild("QuestTask").Value
	quest.QuestGiver.Text = pathfinder:WaitForChild("QuestGiver").Value
	quest.Reward.Text = "$"..pathfinder:WaitForChild("QuestReward").Value
	print("dragon")
	while wait(0.5) do
		quest.ProgressText.Text = pathfinder:WaitForChild("QuestPercent").Value.."/500"
	end
	print("ender")
end

Server Script

--// Leaderstats

local rs = game:GetService("ReplicatedStorage")
local remotes = rs:WaitForChild("QuestRemotes")

-------------------------------------------------------

--// Quest Handler

remotes:WaitForChild("Walk500Studs"):WaitForChild("GiveQuest").OnServerEvent:Connect(function(player)
	remotes:WaitForChild("Walk500Studs"):WaitForChild("GiveQuestClient"):FireClient(player)
	print("pirnteddddd")
	local current = player:WaitForChild('Quest'):WaitForChild('CurrentQuests')
	local WalkStuds = Instance.new("Folder", current)
	WalkStuds.Name = "PathFinder"
	
	local quest = Instance.new("StringValue", WalkStuds)
	quest.Name = "Quest"
	
	local questTask = Instance.new("StringValue", WalkStuds)
	questTask.Name = "QuestTask"
	
	local questPercent = Instance.new("StringValue", WalkStuds)
	questPercent.Name = "QuestPercent"
	
	local questReward = Instance.new("StringValue", WalkStuds)
	questReward.Name = "QuestReward"
	
	local questGiver = Instance.new("StringValue", WalkStuds)
	questGiver.Name = "QuestGiver"
	
	local questdone = Instance.new("BoolValue", WalkStuds)
	questdone.Name = "QuestDone"
	
	----------
	--// Values
	quest.Value = "Path Finder"
	questTask.Value = "Walk 500 Studs"
	questReward.Value = "350"
	questGiver.Value = "Explorer"
	print("yayyy")
end)

remotes:WaitForChild("Walk500Studs"):WaitForChild("QuestDone").OnServerEvent:Connect(function(player)
	workspace.Quests.Walk500Studs.Enabled = false
	local path = player:WaitForChild('Quest'):WaitForChild('CurrentQuests'):WaitForChild('PathFinder')
	path:WaitForChild('QuestPercent').Value = "500"
	path:WaitForChild("QuestDone").Value = true
end)

Please. I can’t fix this

Have you seen any errors at all? Look at your console.
Try doing this

quest.Parent = scrollingframe

EDIT: Do local function instead of function.

It’s not specified with a variable. I’ll do it myself

image
No. The “ok’s” didn’t print

print("hey guyssyfuihewfiuhewfiuwf")
local explorer = workspace["QUEST NPCS"].Part
local player = game.Players.LocalPlayer
local beforegui = player.PlayerGui:WaitForChild("QuestDialouge")
local gui = beforegui:WaitForChild("QuestDialogue")

print("beforegui looolll")
local db = false
print("Hey guys whats up today so im going to say hello")
explorer.Touched:Connect(function()
	print("1")
	if not db then
		db = true
		print("2")
		beforegui.Enabled = true
		print("3")
	gui.NPCName.Text = "Part"
	local chatText = "Hey! I need you to explore this island for me, I need approximately 500 studs explored before I can uncover the mystery of this island, I hear theres a strange thing below here! Will you help me?"
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
			script.Parent.Parent.Sound:Play()
		end
		gui.Option1.Text = "Sure!"
		gui.Option2.Text = "Nope, I don't want to."
		gui.Option1.Visible = true
		gui.Option2.Visible = true
		print("4")
		db = false
	end
end)

local function lol()
	local pathfinder = player:WaitForChild("Quests"):WaitForChild("CurrentQuests"):WaitForChild("PathFinder")
	print("ok")
--[[	local scrollingframe = script.Parent.Parent.Parent:WaitForChild("QuestsFrame"):WaitForChild("QuestsScrollingFrame")
	local questtemp = script.Parent.Parent.Parent:WaitForChild("Handler"):WaitForChild("QuestTemplate")
	questtemp.Parent = scrollingframe
	questtemp.Visible = false ]]--
	local quest = script.Parent.Parent.Parent:WaitForChild("Handler"):WaitForChild("QuestTemplate"):Clone()
	local scrollingframe = script.Parent.Parent.Parent:WaitForChild("QuestsFrame"):WaitForChild("QuestsScrollingFrame")
	print("ok2")
	quest.Parent = scrollingframe
	print("ok3")
	quest.Name = "QuestTemplate"
	print("ok4")
	quest.Visible = true
	print("ok5")
	quest.QuestName.Text = pathfinder:WaitForChild("Quest").Value
	quest.QuestTask.Text = pathfinder:WaitForChild("QuestTask").Value
	quest.QuestGiver.Text = pathfinder:WaitForChild("QuestGiver").Value
	quest.Reward.Text = "$"..pathfinder:WaitForChild("QuestReward").Value
	print("dragon")
	while wait(0.5) do
		quest.ProgressText.Text = pathfinder:WaitForChild("QuestPercent").Value.."/500"
	end
	print("ender")
end

gui.Option1.MouseButton1Click:Connect(function()
	gui.Option1.Visible = false
	gui.Option2.Visible = false
	local chatText = "Thanks man!"
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
		script.Parent.Parent.Sound:Play()
	end
    wait(3)
	beforegui.Enabled = false
	game.ReplicatedStorage.QuestRemotes.Walk500Studs.GiveQuest:FireServer()
	wait(1)
	lol()
end)

gui.Option2.MouseButton1Click:Connect(function()
	gui.Option1.Visible = false
	gui.Option2.Visible = false
	local chatText = "You don't want to? Well.. If you change your mind come to me, I'm waiting for you here."
	for i = 1, string.len(chatText) do
		wait(0.025)
		gui.Dialogue.Text = string.sub(chatText, 1, i)
		script.Parent.Parent.Sound:Play()
	end
	wait(2)
	beforegui.Enabled = false
	game.ReplicatedStorage.QuestRemotes.Walk500Studs.GiveQuest:FireServer()
	wait(1)
	
end)

Please elaborate which “ok’s” in more detail? Where it doesn’t print? Does the 1st one does or didn’t?