Hey! I know I recently posted a question, but I am pretty confused right now. I am not getting any error, but the script just doesn't want to work.
local p=game:GetService("PathfindingService")
local torsos={}
for _,v in pairs(workspace.People:GetChildren())do
for _,w in pairs(v:GetChildren())do
for _,z in pairs(w:GetChildren())do
if z.Name=="Torso"then
torsos[#torsos+1]=z
end
end
end
end
for _,v in pairs(workspace.People:GetChildren())do
wait(.1)
spawn(function()
while wait()do
local target=torsos[math.random(1,#torsos)]
local path=p:ComputeRawPathAsync(v.Torso.Position,target.Position,500)
if path.Status==Enum.PathStatus.Success then
local points=path:GetPointCoordinates()
for _,point in pairs(points)do
local part,P=workspace:FindPartOnRay(Ray.new(point,Vector3.new(0,-10,0)))
if part then
point=P
points[_]=P
end
end
local br=false
local distance;
for _=1,#points,2 do
local point=points[_]
if br then
break
end
local count=0
repeat
count=count+1
if count>100 then
br=true
break
end
v.Humanoid:MoveTo(points[math.min(#points,_+1)])
if point.Y>=v.Humanoid.Torso.Position.Y-1 then
v.Humanoid.Jump=true
end
distance=(point*Vector3.new(1,0,1)-v.Torso.Position*Vector3.new(1,0,1)).magnitude
wait()
until distance<5
end
else
v.Humanoid:MoveTo(v.Torso.CFrame*Vector3.new(0,0,5))
end
end
end)
end

1 comment
Put comments inside the script on how it works so that you can get an answer sooner. We'll be late to figure out how your script works because you have either fixed it yourself, you made a new script or you stopped using it.