How do I make an NPC that can't be pushed but is animated

I want to create an npc that is animated and that can not be moved around. I already know how to make an npc animated using the default animate script from roblox, but this requires the npc to be unanchored, which would allow players to move it around.

I tried teleporting the npc back to it’s original place every so often but that didn’t feel right and it looked really weird.

Any ideas?

1 Like

If your NPC is a Humanoid, you should be able to anchor only the HumanoidRootPart and have some animations still play. (I think)

You could add invisible walls around it if you don’t need players to get too close.

Can you be more specific about exactly what you’re trying to do, or maybe show the script you’re using?

2 Likes

I’ll try only anchoring the humanoid root part, but what I want to do is make it so the npc has idle animations, or could play custom ones so that it feels more lifelike, but not allow players to push it around.

It seems like anchoring the HumanoidRootPart didn’t work, for some reason it freezes the entire npc’s animation. Not sure why this is.

1 Like

I think you anchor the lower torso or humanoid root part

Could I see the script you’re using? Also, maybe try Welding it to an anchored part. I’m really not too familiar with this stuff, but I feel like this would work.

while wait(8) do
	if script.Parent.HumanoidRootPart.Position ~= Vector3.new(-278.663, -134.134, 293.675) then
		script.Parent.HumanoidRootPart.Position = Vector3.new(-278.663, -134.134, 293.675)
		script.Parent.HumanoidRootPart.Orientation = Vector3.new(0, 30, 0)
	end
end

There’s the super simple script that teleports him back to where we has originally was, it sucks.

I meant the animation script.

And try welding the HumanoidRootPart to an Anchored part, that could help.

You can apply a BodyVelocity onto the root part, with these properties:

BodyVelocity.Velocity = Vector3.new(0,0,0)
BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)-- math.huge equals to infinity

It’s not the best solution, but it keeps the NPC in place.
If you want the NPC to experience gravity, set the MaxForce to Vector3.new(math.huge,0,math.huge)

3 Likes

I noticed you can actually move the character a tiny bit VERY SLOWLY but to be honest it’s fine.