I've attempted moving the humanoid (:MoveTo()) to the humanoidrootpart, anchoring the HRP (humanoidrootpart) for a split second, and killing the humanoid doesn't work.
In general im trying to make the npc stop when killed.
pathfinding script:
local ps = game:GetService("PathfindingService")
local hum = script.Parent.Humanoid
local hrp = script.Parent.HumanoidRootPart
local path = ps:CreatePath()
--//
path:ComputeAsync(hrp.Position, game.Workspace.endpart.Position)
for _,waypoint in pairs(path:GetWaypoints()) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
hum:ChangeState(Enum.HumanoidStateType.Jumping)
end
if hum.Health > 0 then
hum:MoveTo(waypoint.Position)
hum.MoveToFinished:Wait(2)
end
end
--//
if hum.Health > 0 then
hum:MoveTo(game.Workspace.endpart.Position)
end

1 comment
can you provide more code