Pathfinding SCP-096 experiencing extremely jerky movements and stops randomly

So I’m working on a SCP-096 for my game, but it just has very bad movements and im not sure whats happening:

This is a gif of it:
https://gyazo.com/2736932c76c19c71e57beaaf96fbeff7

And here is the code for its movement

local function chase(target)	
	while true do
		wait()
		local PFS = game:GetService("PathfindingService")
		local path = PFS:CreatePath()
		path:ComputeAsync(SCP.HumanoidRootPart.Position, target.HumanoidRootPart.Position)
		local waypoints = path:GetWaypoints()
		
		for _, waypoint in pairs(waypoints) do
			SCPHumanoid:MoveTo(waypoint.Position)
			SCPHumanoid.MoveToFinished:Wait()
		end
		
		if target then
			if target.Humanoid.Health == 0 then
				run:Stop()
				sit:Play()
				SCPHumanoid.HipHeight = sitHipHeight
				break
			end
		else
			break
		end
	end
end

Please help!

3 Likes

Hey! I recently had the SAME ISSUE. Here, ill send you a link to my thread, and hopefully it’ll help you, you can read it here: Humanoid:MoveTo() Stuttering, Lagging, Being a total mess

or, if you don’t want to read it, you can just move the SCPHumanoid.MoveToFinished:Wait() out of the loop and see if that fixes it

1 Like

Something Like this

                     for _, waypoint in pairs(waypoints) do
		SCPHumanoid:MoveTo(waypoint.Position)
		
	end
           SCPHumanoid.MoveToFinished:Wait()

it didn’t format properly but I hope you get the point :wink:

That worked! thank you so much!

Glad to help, i was so aggrivated when mine was bugging out. The reason it was happening, was because it was looping through the wait each time which was causing it to stutter, and so by moving it, it only did the Wait() once it reached its destination.

Okay, well thank you for your help!

I also forgot to mention, I made it a bit better with

:SetNetworkOwner(game.Players[target])

1 Like