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

How do I make this script loop? while (true) do not working?

Asked by
Prioxis 673 Moderation Voter
10 years ago

How do I make this repeat?

while (true) do
script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
wait(3)
return
end

I put in while (true) do but it doesn't loop any ideas?

0
Wait, does it move when you test it? Because I think you move the entire "character" not the humanoid Tempestatem 884 — 10y
0
it was intended to move the entire npc from point to point in an infinite loop Prioxis 673 — 10y

2 answers

Log in to vote
3
Answered by 10 years ago
while true do
script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
wait(3)
script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
wait(3)

end

There you go. Thats what a while loop looks like. And if it doesnt matter, oh well.

Ad
Log in to vote
0
Answered by
KAAK82 16
10 years ago
while wait() do --Loops need a wait()
    script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
    wait(3)
    script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
    wait(3)
    script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
    wait(3)
    script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
    wait(3)
end
0
It already has a wait. The problem was he had return, which stops everything. Perci1 4988 — 10y
0
Didn't see the wait()'s I was distracted -_- also, y wont u Answer then? KAAK82 16 — 10y
0
was afk.. Prioxis 673 — 10y

Answer this question