Why does this script keep crashing my studio?

hey guys, um im a new scripter im trying to do a while loop why wont this work?

local folder = game.ReplicatedStorage.Items


while true do
   for i,v in pairs(folder:GetChildren()) do
      print(v)
   end
end

Its an infinite loop. What are you trying to accoplish?

im just trying to looop through a folder thats all

after reading the title of this post, i already knew the script used a while true do loop, use a loop that ends, like for i,v in pairs() do

Add a wait in the loop:

local folder = game.ReplicatedStorage.Items


while true do
   for i,v in pairs(folder:GetChildren()) do
      print(v)
   end
   task.wait()
end


oh okay let me try this real quick thx

You are doing that in the for loop, the outer while loop continues forever. Remove it

1 Like

Yeah I don’t see many reasons why you would need to do it in a loop tho.