How would I handle non-Humanoid NPC movement

Hello everyone,

I’m making an NPC that moves in a straight line but since the NPC has no humanoid I can’t use Humanoid:MoveTo() what are the alternative that works with NPCs without humanoid?

Thank you.

1 Like

Try looking into TweenService, but you might have to create a walking animation if you use it

While TweenService is a good option it’s problem is that you can’t stop it from an outside script which would break the NPCs

I’ve thought about changing the CFrame of the NPC using Heartbeat like this:

Zombie.ZombieMovementEvent = RunService.Heartbeat:Connect(function()
		Part.CFrame *= CFrame.new(Vector3.new(0,0,Zombie.Speed  * -0.01))
   end)

However the script responsible for it would use high activity with high zombie count (around 15% activity at 1000 zombies)

1 Like

Try using a LinearVelocity, create one and set it as the Npc’s HumanoidRootPart child. When you want to “break” by an external script you can simply set its Velocity property to a Vector3.zero

1 Like

I might be wrong but isn’t BodyVelocity deprecated?

Sorry I meant LinearVelocity. If you click on the link It’s the right one, I just confused the name.

1 Like

so after some experiments with linear velocity it came with it’s own issue:

1- The part that it affects can’t be anchored meaning it would be included in the physics calculations

2- The movement sometimes isn’t consistent and any small adjustment to the part would result in weird physics

3- Although the Linear Velocity have an option to modify 1 axis that doesn’t mean it won’t be adjusted at all

4- Double the instances from the other method I used

Thanks for you suggestion though :smiley:

1 Like