Pathfinding with an accessory is drastically slowing down the NPC

I recently made a custom character and have outfitted it with the pathfinding script on the PathfindingService docs. I have now tried putting an accessory on the NPC (through humanoid:AddAccessory(), manually putting it in the model before and after I hit play) and as soon as it goes into the model the speed slows down.

Normal
https://gyazo.com/fe1eaa81d9f336e3454f12ddae8a5969

With Accessory (backpack)
https://gyazo.com/0216b0d2ec7593394bf4366744dcf25c

1 Like

Did you set the backpack too be massless and also turn its canCollide property to false?

It could possibly be colliding with the robot causing its movement to be erratic

I just did both and it still has the same issue.

Found the issue.

I had a script setting the NetworkOwnership of the dummy, fixing it’s own lag/stuttering. The issue was the accessory/backpack had not had it’s NetworkOwnership changed yet, so I simply ran (not my code);

local function setNetworkOwnerOfModel(model, networkOwner)
	for _, descendant in pairs(model:GetDescendants()) do
		if descendant:IsA("BasePart") then
			local success, errorReason = descendant:CanSetNetworkOwnership()
			if success then
				descendant:SetNetworkOwner(networkOwner)
			else
				error(errorReason)
			end
		end
	end
end

local function equipBackpack(pack)
	humanoid:AddAccessory(pack)
	
	setNetworkOwnerOfModel(pack, nil)
end
1 Like