NPC bugging after 3 minutes of moving

Why is the npc bugging after 3 minutes of moving

like this:

how do i fix this? i tried setting the network owner but its still not working

script:

Dumy.HumanoidRootPart:SetNetworkOwner(nil)

MoveToScript:

local PartsFolder = script.Parent.Waypoints
while wait() do
	script.Parent.Dummy.Humanoid:MoveTo(PartsFolder:GetChildren()[math.random(1, #PartsFolder:GetChildren())].Position)
	script.Parent.Dummy.Humanoid.MoveToFinished:Wait()
end

Try this code out:

local model = script.Parent
local waypoints = model:FindFirstChild("Waypoints"):GetChildren()
local char = model:FindFirstChild("Dummy")
local hum = char:FindFirstChildWhichIsA("Humanoid")

local function SetNetworkOwnership()
	for i,v in ipairs(char:GetDescendants()) do
		if v:IsA("BasePart") then
			v:SetNetworkOwner(nil)
		end
	end
end

local function GoToRandom()
	local random = waypoints[math.random(1,#waypoints)]
	
	hum:MoveTo(random.Position)
	hum.MoveToFinished:Wait()
end

SetNetworkOwnership()
while true do
	GoToRandom()
	task.wait(.05)
end

ok, i waited for 3 minutes and its not bugging anymore :slight_smile:

1 Like