Can someone teach me how to make a script that repeats its over and over and over again.
How to make a script repeat itself over and over again?
4 answers
Hello!
Use a while loop.
while true do
print("I'm cool")
wait()
end
Make sure to add a wait() in there or studio will crash!
2 comments
It doesn't crash, it hangs.
Well with my literal bucket of garbage computer it does.
This while loop will loop forever in a script as long as the variable condition is true
local condition = true
while condition do
wait()
end
Additionally you can head over to https://www.robloxdev.com/articles/Roblox-Coding-Basics-Loops to learn more about looping and how it works
while true do is the easiest loop you can have,
while true do
elite hacker code here
end
This depends if you want it too go on forever or a set amount of time.
If you would like it to repeat a certain amount of times do this.
for i = 0,100 do
--Code here
end
Change '100' too whatever number you want.
If you would like it to repeat forever do this
while true do
wait()--make sure you have this. Without it. It will crash the Server/Client.
end
If this helps. Make sure to accept my Answer.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
https://www.robloxdev.com/articles/Roblox-Coding-Basics-Loops