SetNetworkOwnership is not a valid member of Model "Workspace.NPC"

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

It’s SetNetworkOwner.
Not Parent:SetNetworkOwnership.

See BasePart | Roblox Creator Documentation for more info.

Now I get this error

SetNetworkOwner is not a valid member of Model "Workspace.NPC" 

You can’t call this on a model, only on baseparts.

Ok so how can I make the NPC not lag

Set it’s rootpart, all parts are connected to that.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.