local Humanoid = script.Parent:WaitForChild("Humanoid")
local Torso = script.Parent:WaitForChild("Torso")
local Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/asset/?id=180426354"
local LoadedAnimation = Humanoid:LoadAnimation(Animation)
while true do
local targetName = script.Parent:WaitForChild("Target")
local PathService = game:GetService("PathfindingService")
local Target = workspace:WaitForChild(targetName.Value)
local StartPos = Torso.Position
local EndPos = Target.Torso.Position
local path = PathService:FindPathAsync(StartPos, EndPos)
local Waypoints = path:GetWaypoints()
for _, waypoint in pairs(Waypoints) do
Humanoid:MoveTo(waypoint.Position)
LoadedAnimation:Play()
Humanoid.MoveToFinished:Wait(2)
end
wait(0)
end
Since its a loop, of course the animation would keep re playing without actually finishing. I was wondering if there was a way to make it so the animation just plays when moving and that's all.

1 comment
How would I include that into the script though???