MoveTo() making my NPC lag

Whenever I use :MoveTo() on my NPC, it lags really badly. Does anyone know a fix?

This does not have to do with network ownership (I made sure it wasn’t affected by the player’s ownership).

Here’s what it looks like in game:

Here’s what it’s supposed to look like.

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

Here is the script that controls the movements:

function wastetime()
	if num == 0 then
		num = 1
		moveto("fridge")
	elseif num == 1 then
		num = 2
		moveto("oven")
	elseif num == 2 then
		num = 3
		gotoandfacefridge()
	elseif num == 3 then
		num = 4
	elseif num == 4 then
		num = 5
		gotoandfaceoven()
	elseif num == 5 then
		num = 6
		facepart("player")
	elseif num == 6 then
		num = 7
		moveto("backroom")
	elseif num == 7 then
		num = 8
	elseif num == 8 then
		num = 9
		gotoandfacefridge()
	elseif num == 9 then
		num = 10
		facepart("oven")
	elseif num == 10 then
		num = 0
		moveto("oven")
	end
end

The function is in a repeat loop(don’t know if that has to do with anything).

repeat 
			readyfororder = workspace.readyfororder.Value
			if readyfororder ~= true then
			print("doing nothing..")
			print(readyfororder)
				wastetime()
			end
			
		until
		readyfororder == true

You could take a look at simple path or just search it up! You can find tutorials like this:

probably because of the Server-Client boundary

it might look laggy for the client because of ping (probably) while in the server it is smooth

i might be wrong, check the server side instead of the client side (the video you showed is in the client side)

it also happens to me

You need to use :SetNetworkOwner(nil) to the NPC’s HumanoidRootPart
hum:SetNetworkOwner(nil)