How to know weather or not a NPC is moving?

Basically I’m trying to dectect when an NPC is moving then do stuff but whenever i tested it out, The body parts don’t even move. They just slide without changing position.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function()
		while wait() do
			local char = plr.Character or plr.CharacterAdded:Wait()
			local target = findTarget()
			if target then
				script.Parent.Humanoid:MoveTo(target.Position)
				script.Parent.LowerTorso:GetPropertyChangedSignal("Position"):Connect(function()
					-- Doing Stuff
				end)
			end
		end
	end)
end)
1 Like

I think you can use either Humanoid.MoveDirection.Magnitude or a variable that is set to true when you make it start moving and false when it stops moving.

1 Like
if math.floor(humanoidRootPart.Velocity.Magnitude) > 0 then
    -- This Player/NPC is moving
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.