loop roblox lua code example

Example 1: repeating loop roblox

while true do
	-- Your script here
    -- Every loop needs a wait increment, or your game might crash
    wait(1) 
end

Example 2: loop true childs roblox

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

Example 3: forever loop roblox lua

while true do
	print("Hello")
end

Example 4: roblox repeat until

repeat
	spawnGoblin()
	currentGoblinCount = currentGoblinCount + 1
	print("Current goblin count: " .. currentGoblinCount)
until currentGoblinCount == 25

Tags:

Lua Example