Pathfinding is stuttering alot

  1. What do you want to achieve? Fixing stuttering on my pathfinding system

  2. What is the issue? It stutters way too much

  3. What solutions have you tried so far? searching it up but can’t find a good solution

So basically I made this pathfinding system where an npc moves around to random parts within a folder. But whenever it’s moved to a few parts the system suddenly starts stuttering way too much and it will only walk one waypoint per 5 seconds or more.

Here a video:
robloxapp-20230419-1157504.wmv (2.2 MB)

Here the script:


local finish = nil
local pathparts = workspace.Folder:GetChildren()



function start()


finish = pathparts[math.random(1,#pathparts)]
print(finish)
local pathservice = game:GetService("PathfindingService")

local path = pathservice:CreatePath()

path:ComputeAsync(script.Parent.HumanoidRootPart.Position,finish.Position)

local waypoints = path:GetWaypoints()
	for e,v in pairs(waypoints) do
			

		script.Parent.Humanoid:MoveTo(v.Position)
		script.Parent.Humanoid.MoveToFinished:Wait()
		print("waypoint")
		if e == #waypoints then
			start()
			print("reached part")
				
			
			end
			
	

end

end

wait(6)
start()

1 Like

Might be network ownership. You can try:

script.Parent.HumanoidRootPart:SetNetworkOwnership(nil)

This can go at the top of the script.

I put this on the top of the script but however this makes the script not work at all

@noblemaxx Nevermind, I managed to fix it! Even tho this didn’t work with SetNetworkOwnership(nil) It did work with SetNetworkOwner(nil). U still helped me since I never knew anything abt NetworkOwner and those things, Thank u for helping!

1 Like

Haha sorry about that, I’m on my phone so I couldn’t really play test it.

1 Like

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