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?

01while (true) do
02script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
03wait(3)
04script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
05wait(3)
06script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
07wait(3)
08script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
09wait(3)
10return
11end

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
01while true do
02script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
03wait(3)
04script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
05wait(3)
06script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
07wait(3)
08script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
09wait(3)
10 
11end

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
01while wait() do --Loops need a wait()
02    script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, 31) )
03    wait(3)
04    script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, 31) )
05    wait(3)
06    script.Parent.Humanoid:MoveTo(Vector3.new(23, 0.79, -6) )
07    wait(3)
08    script.Parent.Humanoid:MoveTo(Vector3.new(-13, 0.59, -6) )
09    wait(3)
10end
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