Hello, im making a following NPC wich kills you on touch. I would like to make it go back to his orginal location.
Code:
while true do
wait(math.random(1,5))
local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
if target ~= nil and target.Parent.IsAMonster.Value == false and
target.Parent.Humanoid.Health >= 1 then
script.Parent.Humanoid:MoveTo(target.Position, target)
target.Parent.Humanoid.Died:Connect(function()
script.Parent.HumanoidRootPart.CFrame(script.Parent.StarterPosition.CFrame)
end)
end
end

1 comment
Fixed it, thanks!