Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my npc just running into a wall even when he generates a path?

Asked by 5 years ago
Edited 5 years ago

This may be a big ask but can some one look at this code and tell me why the npc is just walking into the wall even tho he generates the path and I tell him to move along the waypoints.

01--Services
02local PathFinding = game:GetService("PathfindingService")
03local RunService = game:GetService("RunService")
04--Variables
05local info = script.Parent
06local owner = info:WaitForChild("Owner").Value
07local character = script.Parent.Parent.Parent
08local charRoot = character.HumanoidRootPart
09local followRoot = script.Parent.Parent:WaitForChild("HumanoidRootPart")
10local followHumanoid = script.Parent.Parent:WaitForChild("Humanoid")
11 
12followRoot.CFrame = charRoot.CFrame + charRoot.CFrame.LookVector * -2
13 
14function checkSight()
15    local ray = Ray.new(followRoot.Position, (charRoot.Position - followRoot.Position).Unit * 360)
View all 73 lines...

https://gyazo.com/a47aa6ddcd5f31100fae150f808e9469

Answer this question