11
111
local npc = script.Parent
local humanoid = npc:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local root = npc:WaitForChild("HumanoidRootPart")
local point1 = workspace:WaitForChild("Point1")
local point2 = workspace:WaitForChild("Point2")
local walkAnimation = npc:WaitForChild("WalkAnimation")
local walkTrack = animator:LoadAnimation(walkAnimation)
humanoid.WalkSpeed = 12
local points = {point1, point2}
local current = 1
while true do
local target = points[current]
-- запускаем анимацию ходьбы
if not walkTrack.IsPlaying then
walkTrack:Play()
end
humanoid:MoveTo(target.Position)
-- ждём, пока дойдёт
humanoid.MoveToFinished:Wait()
-- останавливаем анимацию
walkTrack:Stop()
-- переключаем точку
current = current == 1 and 2 or 1
wait(0.5)
end