Tweening a NPC Zombie makes it fling on the server

Hello, I have made a script that tweens the NPC to the next waypoint. But the problem is whenever I switch to the server view, or when a new player joins in-game, the zombies glitch until they reach the final waypoint and get destroyed (The new ones work). But how could I fix this problem? I am currently tweening the HumanoidRootPart on the server, and all of the parts of the zombies are Massless.

The code in a module script:

local uniqueSeed =
		zombie:PivotTo(, workspace.Spawn.Position.Y + zombie:FindFirstChild("Height").Value, workspace.Spawn.Position.Z))
		local hrp = zombie:FindFirstChild("HumanoidRootPart")
		local ZOMBIE_OFFSET = uniqueSeed:NextNumber(-0.34, 0.34)

		local WalkSpeed = zombie:FindFirstChild("WalkSpeed")

		local Animator = zombie:WaitForChild("AnimationController"):WaitForChild("Animator")
		local anim ="Animation")
		anim.AnimationId = "rbxassetid://14755070010"
		anim.Parent = Animator

		local animation = Animator:LoadAnimation(anim)
		animation.Looped = true
		animation:AdjustSpeed(1 * WalkSpeed.Value/3.9)

		for waypoint = 1, #waypoints:GetChildren() do
			local Distance = (hrp.Position - waypoints[waypoint].Position).Magnitude

			local cframeLookat = CFrame.lookAt(hrp.Position,[waypoint].Position.X, hrp.Position.Y, waypoints[waypoint].Position.Z))

			local rx, ry, rz = cframeLookat:ToOrientation()
			local dx, dy, dz = math.deg(rx), math.deg(ry), math.deg(rz)

			local orientation =, dy, dz)

			local Time = GetTime(Distance, WalkSpeed.Value)

			local moveTween = TweenService:Create(hrp,*1.25, Enum.EasingStyle.Linear), {Position =[waypoint].Position.X + (ZOMBIE_OFFSET*2), hrp.Position.Y, waypoints[waypoint].Position.Z + (ZOMBIE_OFFSET*2))}) 
			local orientationTween = TweenService:Create(hrp,*3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {Orientation = orientation})


I don’t exactly know what the problem is but it could be a serious issue in the future if a player joined late and saw this. ((This system has no Humanoids so don’t suggest anything with MoveTo() or Humanoid properties!!))

I dont know if this will fix anything, but a suggestion for the look system is: calculate the crframe using all x,y,z values of the waypoint, and then set only the y rotation on the zombie. If you set the x or the z you get tilting.


Have you tried to use MoveTo() and MoveToFinished:Wait() on the zombie’s humanoid? It may not be smooth though.

Simply use MoveTo doesn’t the NPCs have humanoids ? :smiley:

Also i would recommend that you learn OOP for better performance and better handling!

I am currently making a no humanoid system because they have outdated code and are kind of lame. MoveTo is also kind of performance heavy while having 40-60 zombies at once.

The zombies current state

The system is working pretty well but there is still flinging on the server view and when a new player joins.