MoveTo extremely laggy for some reason

For some reason my moveto script is very choppy near the player (when I press run in studio it works fine). Its network ownership is set to nil from this script:

local NPC = script.Parent
for _, v in pairs(NPC:GetChildren()) do
	if v:IsA("BasePartPart") then
		v:SetNetworkOwner(nil)
	end
end

Here is the movement script:

function moveto(part)
	if part == "oven" then
		print("walking")
		hum:MoveTo(ovenwalk.Position)
		hum.MoveToFinished:Wait()
	elseif part == "fridge" then
		print("walking")
		hum:MoveTo(fridgewalk.Position)
		hum.MoveToFinished:Wait()
	elseif part == "salt" then
		print("walking")
		hum:MoveTo(saltwalk.Position)
		hum.MoveToFinished:Wait()
	elseif part == "plr" then
		print("walking")
		hum:MoveTo(plrwalk.Position)
		hum.MoveToFinished:Wait()
	elseif part == "backroom" then
		print("walking")
		hum:MoveTo(backroom.Position)
		hum.MoveToFinished:Wait()
	end
end

I don’t really understand why this would be happening. Can somebody please explain?

accidentally set it to “basepartpart” but it still is the same either way.

Hello PETERMAN800!

I had no idea but i think it’s roblox optimization.

Try using PivotTo() instead, that always works for me.

I assume this is a server script, since you said in studio it works fine but not in the actual game. And it appears choppy (probably) because your character is taking the ownership of the character in question. What i am trying to say is you should try to set the humanoid’s networkownership as i believe it’s also a thing for these objects.

Try using runservice, it runs every frame making it smoother… I think it’ll work…

what do you mean set the humanoids network ownership? as in the thing inside a character?