Can someone tell me why quest datastore doesn't work - I cant code

could the reason the quest datastore doesn’t work be because of this script?

task.wait(1)

-- NEW


-- BOOLEANS

local can0 = false
local can = false
local can2 = false
local can3 = false
local can4 = false
local can5 = false

local boughtSlimeSize = false

-- NPCS FOLDER

local npcs = workspace.questNPCs

-- NUMBER OF QUESTS

local quests = 6

-- CREATE PROXIMITY PROMPTS

task.spawn(function()

	for i, v in npcs.beginnerQuestNPC.Cylinder:GetChildren() do
		if v:IsA("ProximityPrompt") then
			v:Destroy()
		end
	end

	for i=1,quests,1 do

		local p = Instance.new("ProximityPrompt")
		p.Parent = npcs.beginnerQuestNPC.Cylinder
		p.Name = "quest"..i
		p.RequiresLineOfSight = false
		p.ObjectText = "NPC"
		p.HoldDuration = .5
		p.ActionText = "View Quest"
		p.Enabled = false
		continue
	end

end)

-- LOADING

game.ReplicatedStorage.events.setupQuest.OnClientEvent:Connect(function(val)
	npcs.beginnerQuestNPC.Cylinder["quest"..val].Enabled = true
end)

game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)

-- SETUP PROXIMITY PROMPTS

npcs.beginnerQuestNPC.Cylinder.quest1.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "Beginner's Quest"
	script.Parent.quest.questDesc.Text = "Name your slime in order to finish this quest!"

	npcs.beginnerQuestNPC.Cylinder.quest1.Enabled = false

	script.Parent:SetAttribute("questName", "Quest1")
end)

npcs.beginnerQuestNPC.Cylinder.quest2.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "Collectibles Quest"
	script.Parent.quest.questDesc.Text = "Collect 15 collectibles and bring them back to this NPC!"

	npcs.beginnerQuestNPC.Cylinder.quest2.Enabled = false

	script.Parent:SetAttribute("questName", "Quest2")
end)
npcs.beginnerQuestNPC.Cylinder.quest3.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "Collect, Level Up, and Upgrade!"
	script.Parent.quest.questDesc.Text = "Collect 30 collectibles, level up to Level 5, and upgrade your slime size!!"
	npcs.beginnerQuestNPC.Cylinder.quest3.Enabled = false

	script.Parent:SetAttribute("questName", "Quest3")
end)

npcs.beginnerQuestNPC.Cylinder.quest4.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "Collect & Explore"
	script.Parent.quest.questDesc.Text = "Collect 60 collectibles, and explore 500 studs!"

	npcs.beginnerQuestNPC.Cylinder.quest4.Enabled = false

	script.Parent:SetAttribute("questName", "Quest4")
end)

npcs.beginnerQuestNPC.Cylinder.quest5.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "Explore More"
	script.Parent.quest.questDesc.Text = "Collect 100 collectibles, and explore 700 studs!"
	npcs.beginnerQuestNPC.Cylinder.quest5.Enabled = false

	script.Parent:SetAttribute("questName", "Quest5")
end)

npcs.beginnerQuestNPC.Cylinder.quest6.Triggered:Connect(function()

	script.Parent.quest.Visible = true

	script.Parent.quest.quest.Text = "That's a big slime!"
	script.Parent.quest.questDesc.Text = "Collect 100 collectibles, and reach slime size 2000!"

	npcs.beginnerQuestNPC.Cylinder.quest6.Enabled = false

	script.Parent:SetAttribute("questName", "Quest6")
end)

-- BUTTONS

-- DESTROY ALL EXISITING LOCAL SCRIPTS

script.Parent.questButton1:FindFirstChildOfClass("LocalScript"):Destroy()
script.Parent.questButton2:FindFirstChildOfClass("LocalScript"):Destroy()
script.Parent.questButton3:FindFirstChildOfClass("LocalScript"):Destroy()
script.Parent.questButton4:FindFirstChildOfClass("LocalScript"):Destroy()
script.Parent.questButton5:FindFirstChildOfClass("LocalScript"):Destroy()
script.Parent.questButton6:FindFirstChildOfClass("LocalScript"):Destroy()

--SETUP BUTTONS

script.Parent.questButtonNormal.MouseButton1Down:Connect(function()

	script.Parent.Quest0.Visible = not script.Parent.Quest0.Visible

end)

script.Parent.questButton1.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest1.Visible = not script.Parent.questUIFolder.Quest1.Visible

end)

script.Parent.questButton2.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest2.Visible = not script.Parent.questUIFolder.Quest2.Visible

end)

script.Parent.questButton3.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest3.Visible = not script.Parent.questUIFolder.Quest3.Visible

end)

script.Parent.questButton4.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest4.Visible = not script.Parent.questUIFolder.Quest4.Visible

end)

script.Parent.questButton5.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest5.Visible = not script.Parent.questUIFolder.Quest5.Visible

end)

script.Parent.questButton6.MouseButton1Down:Connect(function()

	script.Parent.questUIFolder.Quest6.Visible = not script.Parent.questUIFolder.Quest6.Visible

end)

-- trail to quest person
game.ReplicatedStorage.events.requestBeginnerTrail.OnClientEvent:Connect(function()
	local atta0 = Instance.new("Attachment", game.Players.LocalPlayer.Character.PrimaryPart)
	local atta = Instance.new("Attachment", npcs.beginnerQuestNPC.Cylinder)

	local beam = script.mainPart.Beam2:Clone()
	beam.Parent = workspace
	beam.Attachment1 = atta0
	beam.Attachment0 = atta

	for i, v in npcs.beginnerQuestNPC:GetDescendants() do
		if v:IsA("ProximityPrompt") then
			v.Triggered:Connect(function(plr)
				beam:Destroy()
				atta:Destroy()
				atta0:Destroy()
			end)
		end
	end
end)

-- FUNCTIONS

function effect(reward)

	script.Parent.questFinished:TweenPosition(UDim2.new(0.244, 0,0.014, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Back, .5)
	script.Parent.questFinished.questDesc.Text = reward

	script.Finished:Play()
	task.wait(3)

	script.Parent.questFinished:TweenPosition(UDim2.new(0.244, 0,-.087, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back)
end
-- GUI

-- START QUEST

script.Parent.quest.accept.MouseButton1Down:Connect(function()
	local att = script.Parent:GetAttribute("questName")

	script.Parent.questButtonNormal.Visible = false
	script.Parent.Quest0.Visible = false

	script.Parent.questUIFolder.Quest2.plants.inside.Size = UDim2.new(0,0,0,0)
	script.Parent.questUIFolder.Quest2.plants.collec.Text = "Plants Collected - 0"
	script.Parent.questUIFolder.Quest2.plants:FindFirstChild("perc").Text = "0%"

	script.Parent.questUIFolder.Quest3.plants.inside.Size = UDim2.new(0,0,0,0)
	script.Parent.questUIFolder.Quest3.plants.collec.Text = "Plants Collected - 0"
	script.Parent.questUIFolder.Quest3.plants:FindFirstChild("perc").Text = "0%"

	script.Parent.questUIFolder.Quest4.plants.inside.Size = UDim2.new(0,0,0,0)
	script.Parent.questUIFolder.Quest4.plants.collec.Text = "Plants Collected - 0"
	script.Parent.questUIFolder.Quest4.plants:FindFirstChild("perc").Text = "0%"

	script.Parent.questUIFolder.Quest5.plants.inside.Size = UDim2.new(0,0,0,0)
	script.Parent.questUIFolder.Quest5.plants.collec.Text = "Plants Collected - 0"
	script.Parent.questUIFolder.Quest5.plants:FindFirstChild("perc").Text = "0%"

	script.Parent.questUIFolder.Quest6.plants.inside.Size = UDim2.new(0,0,0,0)
	script.Parent.questUIFolder.Quest6.plants.collec.Text = "Plants Collected - 0"
	script.Parent.questUIFolder.Quest6.plants:FindFirstChild("perc").Text = "0%"

	if att == "Quest1" then
		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton1.Visible = true
		script.Parent.questUIFolder.Quest1.Visible = true
		can0 = true

		local ui = script.Parent.questUIFolder.Quest1

		local part = workspace.Gameplay.NameAreas.NameSlime

		local atta0 = Instance.new("Attachment", game.Players.LocalPlayer.Character.PrimaryPart)
		local atta = Instance.new("Attachment", part)

		local beam = script.mainPart.Beam:Clone()
		beam.Parent = workspace
		beam.Attachment1 = atta0
		beam.Attachment0 = atta

		game.ReplicatedStorage.events.CompleteQuest1.OnClientEvent:Connect(function()

			if can0 then
				--script.Parent.TextBox.Visible = false
				script.mainRE:FireServer("addEXP", 200)
				script.mainRE:FireServer("setVal", 2)

				ui.plants.perc.Text = "X"
				ui.plants.inside.Size = UDim2.new(0,0,1,0)

				ui.Visible = false

				script.Parent.questButtonNormal.Visible = true
				script.Parent.questButton1.Visible = false
				can0 = false

				beam:Destroy()
				atta0:Destroy()
				atta:Destroy()

				game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)
				effect("You have finished your first ever quest! Your rewards are 200XP! Return to the Witch!")
				npcs.beginnerQuestNPC.Cylinder.quest2.Enabled = true
				npcs.beginnerQuestNPC.Cylinder.quest1.Enabled = false
				return
			end
		end)
	elseif att == "Quest2" then
		game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)
		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton2.Visible = true
		script.Parent.questUIFolder.Quest2.Visible = true
		can = true

		local ui = script.Parent.questUIFolder.Quest2

		game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)

		game.ReplicatedStorage.events.clicked.OnClientEvent:Connect(function(v)
			local localPlayer = game.Players.LocalPlayer

			if v ~= nil then
				if can==true then
					local g = localPlayer:GetAttribute("PlantsCollectedForQuest")

					localPlayer:SetAttribute("PlantsCollectedForQuest", g+1)
					local progress = math.floor((localPlayer:GetAttribute("PlantsCollectedForQuest")*100)/15)

					if progress == 100 then
						ui:FindFirstChild("plants").perc.Text = "✔"
					else
						ui:FindFirstChild("plants").perc.Text = progress.."%"
					end

					ui:FindFirstChild("plants").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("plants").collec.Text = "Plants Collected - "..localPlayer:GetAttribute("PlantsCollectedForQuest")

					--v:Destroy()

					if localPlayer:GetAttribute("PlantsCollectedForQuest") == 15 then
						script.mainRE:FireServer("addEXP", 510)
						script.mainRE:FireServer("setVal", 3)

						ui.Visible = false

						script.Parent.questButtonNormal.Visible = true
						script.Parent.questButton3.Visible = false
						script.Parent.questButton2.Visible = false
						can = false

						ui:FindFirstChild("plants").perc.Text = "0%"
						ui:FindFirstChild("plants").inside.Size = UDim2.new(0,0,1,0)
						localPlayer:SetAttribute("PlantsCollectedForQuest", 0)

						npcs.beginnerQuestNPC.Cylinder.quest2.Enabled = false
						npcs.beginnerQuestNPC.Cylinder.quest3.Enabled = true

						effect("You have finished your second quest! Your rewards are 500EXP! Return to the Witch!")

						return
					end
				end
			end
		end)
	elseif att == "Quest3" then
		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton3.Visible = true
		script.Parent.questButton1.Visible = false
		script.Parent.questUIFolder.Quest3.Visible = true
		can2 = true

		local part = nil

		for _, parts in workspace:GetDescendants() do
			if parts.Name == "Upgrade" then
				if parts.Parent:GetAttribute("QuestShop") ~= nil then
					part = parts
					break
				else
					continue
				end
			end
		end

		local atta0 = Instance.new("Attachment", game.Players.LocalPlayer.Character.PrimaryPart)
		local atta = Instance.new("Attachment", part)

		local beam = script.mainPart.Beam:Clone()
		beam.Parent = workspace
		beam.Attachment1 = atta0
		beam.Attachment0 = atta

		local ui = script.Parent.questUIFolder.Quest3

		game.ReplicatedStorage.events.clicked.OnClientEvent:Connect(function(v)
			local localPlayer = game.Players.LocalPlayer

			if v ~= nil then
				if can2==true then
					local g = localPlayer:GetAttribute("PlantsCollectedForQuest")

					localPlayer:SetAttribute("PlantsCollectedForQuest", g+1)
					local progress = math.floor((localPlayer:GetAttribute("PlantsCollectedForQuest")*100)/30)

					if progress == 100 then
						ui:FindFirstChild("plants").perc.Text = "✔"
					else
						ui:FindFirstChild("plants").perc.Text = progress.."%"
					end
					ui:FindFirstChild("plants").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("plants").collec.Text = "Plants Collected - "..localPlayer:GetAttribute("PlantsCollectedForQuest")

					--v:Destroy()

					if localPlayer:GetAttribute("PlantsCollectedForQuest") >= 30 then
						can2 = false
						return
					end
				end

			end
		end)

		script.Parent.Parent.HUD.Windows.Upgrades.Close.MouseButton1Down:Connect(function()
			print("CLICKED!!")

			boughtSlimeSize = true

			ui.slime.perc.Text = "✔"
			ui.slime.inside.Size = UDim2.new(1,0,1,0)

			beam:Destroy()
			atta:Destroy()
			atta0:Destroy()

			return
		end)

		task.spawn(function()
			while task.wait() do
				local Players = game:GetService("Players")
				local ReplicatedStorage = game:GetService("ReplicatedStorage")

				local SharedTypes = require(ReplicatedStorage.Types)
				type DataFolder = SharedTypes.DataFolder

				local Player: Player = Players.LocalPlayer
				local DataFolder: DataFolder = Player:WaitForChild("Data") :: DataFolder

				if DataFolder and DataFolder.Level.Value >= 5 then
					local progress = 100

					if progress == 100 then
						ui:FindFirstChild("lvl").perc.Text = "✔"
					else
						ui:FindFirstChild("lvl").perc.Text = progress .. "%"
					end
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress / 100, 0, 1, 0)
					ui:FindFirstChild("lvl").collec.Text = "Level - " .. DataFolder.Level.Value

					if Player:GetAttribute("PlantsCollectedForQuest") >= 30 and DataFolder.Level.Value >= 5 and boughtSlimeSize == true then
						script.mainRE:FireServer("addEXP", 1000)
						script.mainRE:FireServer("addCoins", 500)

						script.mainRE:FireServer("setVal", 4)

						ui.slime.perc.Text = "X"
						ui.slime.inside.Size = UDim2.new(0, 0, 1, 0)

						ui.Visible = false

						script.Parent.questButtonNormal.Visible = true
						script.Parent.questButton3.Visible = false
						script.Parent.questButton1.Visible = false
						can2 = false

						ui:FindFirstChild("plants").perc.Text = "0%"
						ui:FindFirstChild("plants").inside.Size = UDim2.new(0, 0, 1, 0)

						ui:FindFirstChild("lvl").perc.Text = "0%"
						ui:FindFirstChild("lvl").inside.Size = UDim2.new(0, 0, 1, 0)

						Player:SetAttribute("PlantsCollectedForQuest", 0)
						effect("You have finished your third quest! Your rewards are 1000XP and 500 Coins! Return to the Witch!")
						npcs.beginnerQuestNPC.Cylinder.quest4.Enabled = true
						npcs.beginnerQuestNPC.Cylinder.quest3.Enabled = false
						boughtSlimeSize = false
						break
					end
				else
					local progress = math.floor((DataFolder.Level.Value * 100) / 5)

					if progress == 100 then
						ui:FindFirstChild("lvl").perc.Text = "✔"
					else
						ui:FindFirstChild("lvl").perc.Text = progress .. "%"
					end
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress / 100, 0, 1, 0)
					ui:FindFirstChild("lvl").collec.Text = "Level - " .. DataFolder.Level.Value
				end
			end
		end)
	elseif att == "Quest4" then

		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton4.Visible = true
		script.Parent.questButton2.Visible = false
		script.Parent.questUIFolder.Quest4.Visible = true
		can3 = true

		local ui = script.Parent.questUIFolder.Quest4

		game.ReplicatedStorage.events.clicked.OnClientEvent:Connect(function(v)
			local localPlayer = game.Players.LocalPlayer

			if v ~= nil then
				if can3==true then
					local g = localPlayer:GetAttribute("PlantsCollectedForQuest")

					localPlayer:SetAttribute("PlantsCollectedForQuest", g+1)
					local progress = math.floor((localPlayer:GetAttribute("PlantsCollectedForQuest")*100)/60)

					if progress == 100 then
						ui:FindFirstChild("plants").perc.Text = "✔"
					else
						ui:FindFirstChild("plants").perc.Text = progress.."%"
					end
					ui:FindFirstChild("plants").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("plants").collec.Text = "Plants Collected - "..localPlayer:GetAttribute("PlantsCollectedForQuest")

					--v:Destroy()

					if localPlayer:GetAttribute("PlantsCollectedForQuest") >= 60 then
						can3 = false
						return
					end
				end
			end
		end)

		local lastposition = npcs.beginnerQuestNPC.Cylinder.Position

		task.spawn(function()
			local character = game.Players.LocalPlayer.Character
			while task.wait() do
				local Magnitude = math.floor((character:WaitForChild("HumanoidRootPart").Position - lastposition).Magnitude)

				local progress = math.floor((Magnitude*100)/500)

				if progress >= 101 then
					progress = 100
				end
				if progress == 100 then
					ui:FindFirstChild("lvl").perc.Text = "✔"
				else
					ui:FindFirstChild("lvl").perc.Text = progress.."%"
				end
				ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress/100,0,1,0)
				ui:FindFirstChild("lvl").collec.Text = "Studs Explored - "..Magnitude

				if math.floor(Magnitude) >= 500 and game.Players.LocalPlayer:GetAttribute("PlantsCollectedForQuest") >= 60 then

					script.mainRE:FireServer("addEXP", 2000)
					script.mainRE:FireServer("addCoins", 500)

					script.mainRE:FireServer("setVal", 5)

					ui.Visible = false

					script.Parent.questButtonNormal.Visible = true
					script.Parent.questButton4.Visible = false
					script.Parent.questButton1.Visible = false

					ui:FindFirstChild("plants").perc.Text = "0%"
					ui:FindFirstChild("plants").inside.Size = UDim2.new(0,0,1,0)

					ui:FindFirstChild("lvl").perc.Text = "0%"
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(0,0,1,0)

					game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)
					npcs.beginnerQuestNPC.Cylinder.quest5.Enabled = true
					npcs.beginnerQuestNPC.Cylinder.quest4.Enabled = false
					effect("You have finished your fourth quest! Your rewards are 2000XP and 500 Coins! Return to the Witch!")
					break
				end

			end
		end)
	elseif att == "Quest5" then

		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton5.Visible = true
		script.Parent.questButton3.Visible = false
		script.Parent.questUIFolder.Quest5.Visible = true
		can4 = true

		local ui = script.Parent.questUIFolder.Quest5

		game.ReplicatedStorage.events.clicked.OnClientEvent:Connect(function(v)
			local localPlayer = game.Players.LocalPlayer

			if v ~= nil then
				if can4==true then
					local g = localPlayer:GetAttribute("PlantsCollectedForQuest")

					localPlayer:SetAttribute("PlantsCollectedForQuest", g+1)
					local progress = math.floor((localPlayer:GetAttribute("PlantsCollectedForQuest")*100)/100)

					if progress == 100 then
						ui:FindFirstChild("plants").perc.Text = "✔"
					else
						ui:FindFirstChild("plants").perc.Text = progress.."%"
					end
					ui:FindFirstChild("plants").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("plants").collec.Text = "Plants Collected - "..localPlayer:GetAttribute("PlantsCollectedForQuest")

					--v:Destroy()

					if localPlayer:GetAttribute("PlantsCollectedForQuest") >= 100 then
						can4 = false
						return
					end
				end
			end
		end)

		local lastposition = npcs.beginnerQuestNPC.Cylinder.Position

		task.spawn(function()
			local character = game.Players.LocalPlayer.Character
			while task.wait() do
				local Magnitude = math.floor((character:WaitForChild("HumanoidRootPart").Position - lastposition).Magnitude)

				local progress = math.floor((Magnitude*100)/700)
				if progress >= 101 then
					progress = 100
				end
				if progress == 100 then
					ui:FindFirstChild("lvl").perc.Text = "✔"
				else
					ui:FindFirstChild("lvl").perc.Text = progress.."%"
				end
				ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress/100,0,1,0)
				ui:FindFirstChild("lvl").collec.Text = "Studs Explored - "..Magnitude

				if math.floor(Magnitude) >= 700 then

					script.mainRE:FireServer("addEXP", 2000)
					script.mainRE:FireServer("addCoins", 3000)

					script.mainRE:FireServer("setVal", 6)

					ui.Visible = false

					script.Parent.questButtonNormal.Visible = true
					script.Parent.questButton5.Visible = false
					script.Parent.questButton1.Visible = false

					ui:FindFirstChild("plants").perc.Text = "0%"
					ui:FindFirstChild("plants").inside.Size = UDim2.new(0,0,1,0)

					ui:FindFirstChild("lvl").perc.Text = "0%"
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(0,0,1,0)

					game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)
					npcs.beginnerQuestNPC.Cylinder.quest6.Enabled = true
					npcs.beginnerQuestNPC.Cylinder.quest5.Enabled = false
					effect("You have finished your fifth quest! Your rewards are 2000XP and 3000 Coins! Return to the Witch!")
					break
				end

			end
		end)
	elseif att == "Quest6" then

		script.Parent.quest.Visible = false

		script.Parent.questButtonNormal.Visible = false
		script.Parent.questButton6.Visible = true
		script.Parent.questButton4.Visible = false
		script.Parent.questUIFolder.Quest6.Visible = true
		can5 = true

		local ui = script.Parent.questUIFolder.Quest6

		game.ReplicatedStorage.events.clicked.OnClientEvent:Connect(function(v)
			local localPlayer = game.Players.LocalPlayer

			if v ~= nil then
				if can5==true then
					local g = localPlayer:GetAttribute("PlantsCollectedForQuest")

					localPlayer:SetAttribute("PlantsCollectedForQuest", g+1)
					local progress = math.floor((localPlayer:GetAttribute("PlantsCollectedForQuest")*100)/100)

					if progress == 100 then
						ui:FindFirstChild("plants").perc.Text = "✔"
					else
						ui:FindFirstChild("plants").perc.Text = progress.."%"
					end
					ui:FindFirstChild("plants").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("plants").collec.Text = "Plants Collected - "..localPlayer:GetAttribute("PlantsCollectedForQuest")

					--v:Destroy()

					if localPlayer:GetAttribute("PlantsCollectedForQuest") >= 100 then
						can5 = false
						return
					end
				end
			end
		end)

		task.spawn(function()
			while task.wait() do

				if game.Players.LocalPlayer.leaderstats["Slime Size"].Value >= 2000 then
					local progress = 100

					if progress == 100 then
						ui:FindFirstChild("lvl").perc.Text = "✔"
					else
						ui:FindFirstChild("lvl").perc.Text = progress.."%"
					end
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("lvl").collec.Text = "Slime Size - "..game.Players.LocalPlayer.leaderstats["Slime Size"].Value

					if game.Players.LocalPlayer:GetAttribute("PlantsCollectedForQuest") >= 100 and game.Players.LocalPlayer.leaderstats["Slime Size"].Value >= 2000 then

						script.mainRE:FireServer("addEXP", 3000)
						script.mainRE:FireServer("addCoins", 1000)

						--script.mainRE:FireServer("setVal", 7)

						ui.Visible = false

						script.Parent.questButtonNormal.Visible = true
						script.Parent.questButton6.Visible = false
						script.Parent.questButton4.Visible = false
						can5 = false

						ui:FindFirstChild("plants").perc.Text = "0%"
						ui:FindFirstChild("plants").inside.Size = UDim2.new(0,0,1,0)

						ui:FindFirstChild("lvl").perc.Text = "0%"
						ui:FindFirstChild("lvl").inside.Size = UDim2.new(0,0,1,0)

						game.Players.LocalPlayer:SetAttribute("PlantsCollectedForQuest", 0)
						effect("You have finished your sixth quest! Your rewards are 3000XP and 1000 Coins!")
						break


					end
				else
					local progress = math.floor((game.Players.LocalPlayer.leaderstats["Slime Size"].Value*100)/2000)

					if progress == 100 then
						ui:FindFirstChild("lvl").perc.Text = "✔"
					else
						ui:FindFirstChild("lvl").perc.Text = progress.."%"
					end
					ui:FindFirstChild("lvl").inside.Size = UDim2.new(progress/100,0,1,0)
					ui:FindFirstChild("lvl").collec.Text = "Slime Size - "..game.Players.LocalPlayer.leaderstats["Slime Size"].Value
				end

			end
		end)
	end
end)

-- STOP QUEST

script.Parent.quest.nah.MouseButton1Down:Connect(function()
	local att = script.Parent:GetAttribute("questName")

	script.Parent.quest.Visible = false

	if att == "Quest1" then
		npcs.beginnerQuestNPC.Cylinder.quest1.Enabled = true
	elseif att == "Quest2" then
		npcs.beginnerQuestNPC.Cylinder.quest2.Enabled = true
	elseif att == "Quest3" then
		npcs.beginnerQuestNPC.Cylinder.quest3.Enabled = true
	elseif att == "Quest4" then
		npcs.beginnerQuestNPC.Cylinder.quest4.Enabled = true
	elseif att == "Quest5" then
		npcs.beginnerQuestNPC.Cylinder.quest5.Enabled = true
	elseif att == "Quest6" then
		npcs.beginnerQuestNPC.Cylinder.quest6.Enabled = true
	end
end)

or this script?

local update = game.ReplicatedStorage.events.UpdatePlayerData
local profiles = require(game.ServerScriptService.PlayerData.manager).Profiles

script.Parent.mainRE.OnServerEvent:Connect(function(plr, arg, na)

	-- Get the player's profile
	local profile = profiles[plr]

	-- Get or create the DataFolder
	local dataFolder = plr:FindFirstChild("DataFolder")
	if not dataFolder then
		warn("DataFolder not found for player:", plr.Name)
		return
	end

	-- Handle different arguments
	if arg == "addLVL" then
		local level = dataFolder:FindFirstChild("Level")
		if level then
			level.Value += na
			profile.Data.Data.Level += na
			update:Fire()
		else
			warn("Level value not found in DataFolder for player:", plr.Name)
		end

	elseif arg == "addEXP" then
		local experience = dataFolder:FindFirstChild("Experience")
		if experience then
			experience.Value += na
			profile.Data.Data.Experience += na
			update:Fire()
		else
			warn("Experience value not found in DataFolder for player:", plr.Name)
		end

	elseif arg == "addCoins" then
		local money = dataFolder:FindFirstChild("Money")
		if money then
			money.Value += na
			profile.Data.Data.Money += na
			update:Fire()
		else
			warn("Money value not found in DataFolder for player:", plr.Name)
		end

	elseif arg == "setVal" then
		local questNum = dataFolder:FindFirstChild("QuestNum")
		if questNum then
			questNum.Value = na
		else
			warn("QuestNum value not found in DataFolder for player:", plr.Name)
		end
	end
end)

i dont see anything wrong with this code

could you show the script that saves data

local dss = game:GetService("DataStoreService"):GetDataStore("heytho")

function getKey(plr)

	return plr.UserId.."-growyourslimes"

end

function save(plr)

	local success, err = pcall(function()

		dss:SetAsync(getKey(plr), plr.QuestNum.Value)

	end)

	if success then
		-- print("SAVED QUEST!")
	end

end

function load(plr)

	local data

	local success, err = pcall(function()
		data = dss:GetAsync(getKey(plr))
	end)

	if success then
		-- print("LOADED QUEST!")
	end

	return data
end

game.Players.PlayerAdded:Connect(function(plr)

	local n = Instance.new("NumberValue", plr)
	n.Name = "QuestNum"
	n.Value = 1

	local d = load(plr)

	if d ~= nil then
		if d == 1 then
			game.ReplicatedStorage.events.requestBeginnerTrail:FireClient(plr)
		end
		n.Value = d
	else
		n.Value = 1
		game.ReplicatedStorage.events.requestBeginnerTrail:FireClient(plr)
	end

	game.ReplicatedStorage.events.setupQuest:FireClient(plr, n.Value)

end)

game.Players.PlayerRemoving:Connect(save)

game:BindToClose(function()
	for i, v in game.Players:GetPlayers() do
		save(v)
	end
end)

This may be the issue, you parented the QuestNum value in the save script to the player, not the datafolder