Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to wait until my AI has reached a Node?

Asked by 1 year ago
local npc = script.Parent
local humanoid = script.Parent.Humanoid
local animation = script.Parent.Animation
local nodes = {workspace.NpcNodes.Node,workspace.NpcNodes.Node.Node,workspace.NpcNodes.Node.Node.Node}
wait(3) -- to load in

local animationtrack = humanoid.Animator:LoadAnimation(animation)
animationtrack:Play()
if animationtrack.IsPlaying then
    npc.Potion["blue goo"]:Destroy()
end

humanoid.MaxHealth = 100000
humanoid.Health = humanoid.MaxHealth
humanoid.WalkSpeed = 100
game:GetService("ReplicatedStorage").chargeUp.Parent = npc.HumanoidRootPart

for i=1,3,1 do
    humanoid:MoveTo(nodes[i].Position)
end

In the for loop How do i wait until the humanoid is done moving to the part?

1 answer

Log in to vote
0
Answered by 1 year ago
--in the loop
repeat until humanoid.Parent.HumanoidRootPart.Position = nodes[i].Position
end
0
ill try that thanks. mono67890 -2 — 1y
0
Didnt work mono67890 -2 — 1y
Ad

Answer this question