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

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

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?

2 comments

0

Wait, does it move when you test it? Because I think you move the entire "character" not the humanoid

0

it was intended to move the entire npc from point to point in an infinite loop

2 answers

✓ Accepted answer
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.

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

3 comments

0

It already has a wait. The problem was he had return, which stops everything.

0

Didn't see the wait()'s I was distracted -_- also, y wont u Answer then?

0

was afk..

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