Hello! I decided to make really weird game because I was bored, and I want an npc to chase after you. I have code for it, except it is not working. No error is given. Here is the code:
function findNearestTorso(pos)
local torso = nil
local dist = 99999999999999999999999999999999999999999999999999999999999999999999999999
local temp2 = nil
local temp = nil
local list = workspace:GetChildren()
for x = 1, #list do
temp2 = list[x]
temp = temp2:FindFirstChild('Torso') or temp2:FindFirstChild('UpperTorso')
if temp then
if (temp.Position - pos).Magnitude < dist then
torso = temp
dist = (temp.Position - pos).Magnitude
end
end
end
return torso
end
local target = findNearestTorso(script.Parent.UpperTorso.Position)
local pfs = game:GetService("PathfindingService")
local path = pfs:CreatePath()
local waypoints = path:GetWaypoints()
path:ComputeAsync(script.Parent.UpperTorso.Position, target.Position)
for _, v in pairs(waypoints) do
if v.Action == Enum.PathWaypointAction.Jump then
script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
script.Parent.Humanoid:MoveTo(v.Position)
script.Parent.Humanoid.MoveToFinished:Wait(2)
end

5 comments
I'm new to this site and didin't really knew how the text worked, sorry.
are you nuts
Try to search a path finding system in the toolbox.
It looks like a zombie script. Are you trying to make it go to a player but its not working, Just search a zombie in toolbox, Copy its scripts and Folder(if there is any) and put it in your creature
didint help