I am trying to make a maze/horror game. I used an online template in the Roblox library as my enemy. I used pathfinder as you will see in the code below. It's finding me like it's supposed to, except it only goes for my LAST position. As you can see in the image below, it completely skipped me, went to my LAST position, then started chasing me. I don't know why it only goes for my last position, and not my current position.
local PathFindingS = game:GetService("PathfindingService") local humanoid = script.Parent:WaitForChild("Humanoid") local rootPart = script.Parent:WaitForChild("HumanoidRootPart") local Players = game:GetService("Players") game.Workspace.Fruity.Humanoid.WalkSpeed = 60 --To calculate the path while wait() do for i, player in pairs(game.Players:GetPlayers()) do local character = game.Workspace:WaitForChild(player.Name) local characterPos = character.PrimaryPart.Position local path = PathFindingS:CreatePath() path:ComputeAsync(rootPart.Position, characterPos) game.Workspace.Fruity.HumanoidRootPart:SetNetworkOwner(nil) local waypoints = path:GetWaypoints() for i, waypoint in pairs(waypoints) do local part = Instance.new("Part") part.Shape = "Ball" part.Material = "Neon" part.Size = Vector3.new(0.6,0.6,0.6) part.Position = waypoint.Position + Vector3.new(0,2,0) part.Anchored = true part.CanCollide = false part.Parent = game.Workspace humanoid:MoveTo(waypoint.Position) humanoid.MoveToFinished:Wait() end end end 