Hi so Im using roblox pathfinding service to make an NPC but its starting to lag and Im trying to SetNetworkOwnership but its not working can someone please help
Script
local PFS = game:GetService("PathfindingService")
print(script.Parent.Parent.Parent.Name)
script.Parent.Parent.Parent:SetNetworkOwnership()
function createPath(target)
local agentParams = {
AgentHeight = 2.5,
AgentRadius = 2,
AgentCanJump = true
}
print(script.Parent.Parent.Parent.Name)
local path = PFS:CreatePath(agentParams)
path:ComputeAsync(script.Parent.Parent.Parent.HumanoidRootPart.Position, target.Position)
if path.Status == Enum.PathStatus.Success then
local wayPoints = path:GetWaypoints()
return path, wayPoints
end
end