Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to wait until my AI has reached a Node?

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

--in the loop
repeat until humanoid.Parent.HumanoidRootPart.Position = nodes[i].Position
end

2 comments

0

ill try that thanks.

0

Didnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.