After im start the wave, npcs walk normally,but after some time they can do little teleports

My Npcs Walk code


char = script.Parent
dests = {workspace.dest1, workspace.dest2,workspace.dest3}
local n = 0
local touched = false
health = workspace.dest3:WaitForChild("Health")

function NextDest(part)
	if not touched and part.Parent == char then
		touched = true
		n = n+1 
		local new_dest = dests[n]:Clone()
		new_dest.Parent = workspace
		new_dest.Position = dests[n].Position
		char.Humanoid:MoveTo(new_dest.Position)
		char.Humanoid.MoveToFinished:Wait()
		touched = false
		new_dest:Destroy()
	end
end

function DestroyNPC(part)
	if part.Parent == char then
		part.Parent:Destroy()
		_G.wavenpcs = _G.wavenpcs - 1
		health.Value = health.Value - 0
	end
end

workspace.Spawner.Touched:Connect(NextDest)
workspace.dest1.Touched:Connect(NextDest)
workspace.dest2.Touched:Connect(NextDest)
workspace.dest3.Touched:Connect(DestroyNPC)

I hope somebody know what i can do for fix this

ShowCase: https://gifyu.com/image/jKQn

4 comments

0

try using WalkToPoint, pretty sure that can be overridden too

0

Bruh it didnt help :c

0

Try lowering their spawn rate.

0

im lower this right now and they anyway after some time do a teleports