My pathfinding enemy is stuttering. I’ve tried adding :SetNetworkOwner(nil) like some other people but that doesn’t seem to work. Its my first time using network owner thingy so maybe i messed something up
Script:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local PathfindingService = game:GetService("PathfindingService")
function Chase()
local path = PathfindingService:CreatePath()
script.Parent.HumanoidRootPart:SetNetworkOwner(nil)
for i, v in pairs(Players:GetPlayers()) do
if v.Character then
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, v.Character.HumanoidRootPart.Position)
if path.Status == Enum.PathStatus.Success then
local waypoints = path:GetWaypoints()
for waypointIndex, waypoint in pairs(waypoints) do
script.Parent.Humanoid:MoveTo(waypoint.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
end
end
end
end
RunService.Heartbeat:Connect(Chase)