Npc walking script error

Hello devs!
so i got this npc walking script with way points and i got the error

Workspace.path.Rig.Script:8: attempt to index nil with 'Position'

can someone please tell me whats wrong? heres the script

local Humanoid = script.Parent.Humanoid
local Folder = game.Workspace.path -- put your folder name here
local loop = true -- rename it to false if you don't want it to loop

if loop then
	while true do
		for i, v in pairs(Folder:GetChildren()) do
			Humanoid:MoveTo(Folder:FindFirstChild(i).Position)
			Humanoid.MoveToFinished:Wait()
		end
	end
else
	for i, v in pairs(Folder:GetChildren()) do
		Humanoid:MoveTo(Folder:FindFirstChild(i).Position)
		Humanoid.MoveToFinished:Wait()
	end
end

the error is on line 8

fixed it

eeeeeeeeeeeeeeeeeeeeeee

1 Like

What was wrong with the code? It looks all fine when looking at it.

1 Like

i fixed it
thanks for the feedback tho

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.