My code isn't working?

Hello, I am trying to make a thing where the player creates paths and an NPC follows them. The NPC is not following them.
Spawning the paths–

local point1pos = game:GetService("ReplicatedStorage").Point1Position.Value

local pointnum = game:GetService("ReplicatedStorage").PointNumber.Value
local point = game:GetService("ReplicatedStorage").Point

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local mouse = player:GetMouse()
local mousepos = mouse.Hit.Position

	point1pos = mousepos
	mousepos = mouse.Hit.Position
	local part = point:Clone()
	part.Parent = workspace.Folder
	part.Position = mousepos
	part.Name = ("Point"..pointnum)
	pointnum += 1

Spawning the NPC–

local point1pos = game:GetService("ReplicatedStorage").Point1Position.Value

local button = script.Parent

	local NPC = game:GetService("ReplicatedStorage").Bob:Clone()
	NPC.Parent = workspace

NPC pathfind–

local ps = game:GetService("PathfindingService")
local humanoid = script.Parent.Parent.Humanoid

for i, v in pairs(workspace.Folder) do

Somebody please help.

Instead, you should be doing:

for i,v in pairs(workspace.Folder:GetChildren()) do

Hope this helped!

I think this is the solution but it turns out my npc script isn’t even running?

Which npc script? I see 2 in your first post.

The script for the npc to pathfind

Check the output for errors. If there are none, use print() while it is looping through the folder’s contents.

There are no errors and I already did that but no output.

is the npc’s humanoidrootpart unanchored

Yes but the script is not even running

put print statement on very top of script

Make “NPC pathfind” script disabled and let “Spawning the NPC” enable the script after the NPC is parented to the workspace.

I didn’t get any output from it.

Ok I just tried that and it didn’t do anything.