Hello, so I’m making a pathfinding Monster. I want the monster to go to the play using pathfinding. One problem. When the player moves it goes to the old position. Heres a video of this happening https://gyazo.com/4cf5418872a316bc9e4f757d7d1b488d
as you can see it goes to the old pos. This is the piece of code that does the pathfinding.
function MoveBasicMonster()
Monster.PrimaryPart:SetNetworkOwner(nil)
while wait() do
local PathFindingService = game:GetService("PathfindingService")
for i,v in pairs(workspace:GetChildren()) do
if v:FindFirstChildWhichIsA("Humanoid") and v ~= Monster then
local Path = PathFindingService:CreatePath()
Path:ComputeAsync(Monster.HumanoidRootPart.Position, v.HumanoidRootPart.Position)
if Path.Status == Enum.PathStatus.Success then
local WayPoints = Path:GetWaypoints()
for i,Point in pairs(WayPoints) do
Monster.Humanoid:MoveTo(Point.Position)
Monster.Humanoid.MoveToFinished:Wait()
end
end
end
end
end
end
end
Any help is apreciated.