roblox studio while loop code example

Example 1: loop true childs roblox

for i,v in pairs(game.Players:GetChildren()) do
-- v is your player
end

Example 2: loop roblox studio

while wait() do
	print("Looping...") -- This Will Loop
  	wait() -- Make Sure The Script Doesnt Crash
end)
-- Another Method 
while true do
	print("Looping...") -- This Will Loop
	wait() -- Make Sure The Script Doesnt Crash
end)

Example 3: roblox for loop

local Table = {"Hello", 1234, "Whatever"}

for i, Entry in pairs(Table) do
	print(i)
	print(Entry)
end

--> 1
--> Hello

--> 2
--> 1234

--> 3
--> Whatever

Tags:

Lua Example