im currently trying to make an AI that chases the player around the map but it randomly seems to stop working and returning PathStatus.NoPath all of a sudden along with this, the AI also suddenly walks into walls and this continues no matter where the player moves im currently using SimplePath for the AI btw if that helps (ik it’s returning PathStatus.NoPath cause i looked at simplepath’s code to see how it handles computationalerrors)
code?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!
I’m on mobile rn so I can’t send it but u can search up SimplePath to get it, all I’m doing is using :Run() in a loop
incase its helpful heres the code im using (its in a module with a ChasePlayer method that is ran in a while loop):
local MoveDirection = Vector3.zero
if self:IsPathToPlayerBlocked(self.Rig, self.NearestPlayer) == false then
-- calculate distance to be applied between enemies so they dont form a massive clump
local NumberNPCsApplied = 0
for _, OtherNPC in pairs(workspace.Enemies:GetChildren()) do
if OtherNPC == self.Rig then
continue
end
if OtherNPC:FindFirstChild("HumanoidRootPart") == nil then
continue
end
local Direction = OtherNPC.HumanoidRootPart.Position - self.RootPart.Position
local Distance = Direction.Magnitude
if Distance < 10 then
NumberNPCsApplied += 1
MoveDirection += -Direction.Unit
end
end
if NumberNPCsApplied ~= 0 then
MoveDirection /= (NumberNPCsApplied / 10)
end
end
self.Path:Run(self.NearestPlayer.HumanoidRootPart.Position + MoveDirection)
oh…
sorry i uh, i’ve never used simplepath before
D:
1 Like
Simple path didnt work either for me after some random roblox update, its not your fault
1 Like