Looping a local script

Hello! im trying to make script i’ve made a while back ago looped or something like that. i just want it to keep playing nonstop

script.Parent.Text = “10”
wait(1)
script.Parent.Text = “9”
wait(1)
script.Parent.Text = “8”
wait(1)
script.Parent.Text = “7”
wait(1)
script.Parent.Text = “6”
wait(1)
script.Parent.Text = “5”
wait(1)
script.Parent.Text = “4”
wait(1)
script.Parent.Text = “3”
wait(1)
script.Parent.Text = “2”
wait(1)
script.Parent.Text = “1”
wait(1)
script.Parent.Text = “CHOOSING MAP”
wait(0.1)
script.Parent.Text = “MAP CHOSEN”
wait(1)
game.Workspace.MAPS.map1.CFrame = CFrame.new(40.286, 3, 12.586)
wait(2)
script.Parent.Text = “MAP NAME: DESERT”
wait(2)
script.Parent.Text = “TELEPORTING PLAYER’S”
wait(2)
game.ReplicatedStorage.LOL.IMAGINE.USING.SIMPLE.SPY:FireServer()
local textLabel = script.Parent
for i = 20,0,-1 do
** textLabel.Text = i**
** wait(1)**
** if textLabel.Text == “0” then**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, 16.68, 15.795)**
** wait(0.1)**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, -169.59, 15.795)**
** game.Workspace.MAPS.map1.CFrame = CFrame.new(-329.95, 0.5, 0.965)**
** wait(10)**
** script.Parent.Text = “10”**
** wait(1)**
** script.Parent.Text = “9”**
** wait(1)**
** script.Parent.Text = “8”**
** wait(1)**
** script.Parent.Text = “7”**
** wait(1)**
** script.Parent.Text = “6”**
** wait(1)**
** script.Parent.Text = “5”**
** wait(1)**
** script.Parent.Text = “4”**
** wait(1)**
** script.Parent.Text = “3”**
** wait(1)**
** script.Parent.Text = “2”**
** wait(1)**
** script.Parent.Text = “1”**
** wait(1)**
** script.Parent.Text = “CHOOSING MAP”**
** wait(0.1)**
** script.Parent.Text = “MAP CHOSEN”**
** wait(1)**
** game.Workspace.MAPS.map2.CFrame = CFrame.new(40.286, 3, 12.586)**
** wait(2)**
** script.Parent.Text = “MAP NAME: HILL”**
** wait(2)**
** script.Parent.Text = “TELEPORTING PLAYER’S”**
** wait(2)**
** game.ReplicatedStorage.LOL.IMAGINE.USING.SIMPLE.SPY:FireServer()**
** local textLabel = script.Parent**
** for i = 20,0,-1 do**
** textLabel.Text = i**
** wait(1)**
** if textLabel.Text == “0” then**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, 16.68, 15.795)**
** wait(0.1)**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, -169.59, 15.795)**
** game.Workspace.MAPS.map2.CFrame = CFrame.new(-329.95, 0.5, 0.965)**
** wait(10)**
** script.Parent.Text = “10”**
** wait(1)**
** script.Parent.Text = “9”**
** wait(1)**
** script.Parent.Text = “8”**
** wait(1)**
** script.Parent.Text = “7”**
** wait(1)**
** script.Parent.Text = “6”**
** wait(1)**
** script.Parent.Text = “5”**
** wait(1)**
** script.Parent.Text = “4”**
** wait(1)**
** script.Parent.Text = “3”**
** wait(1)**
** script.Parent.Text = “2”**
** wait(1)**
** script.Parent.Text = “1”**
** wait(1)**
** script.Parent.Text = “CHOOSING MAP”**
** wait(0.1)**
** script.Parent.Text = “MAP CHOSEN”**
** wait(1)**
** game.Workspace.MAPS.map3.CFrame = CFrame.new(40.286, 3, 12.586)**
** wait(2)**
** script.Parent.Text = “MAP NAME: CLOUDS”**
** wait(2)**
** script.Parent.Text = “TELEPORTING PLAYER’S”**
** wait(2)**
** game.ReplicatedStorage.LOL.IMAGINE.USING.SIMPLE.SPY:FireServer()**
** local textLabel = script.Parent**
** for i = 20,0,-1 do**
** textLabel.Text = i**
** wait(1)**
** if textLabel.Text == “0” then**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, 16.68, 15.795)**
** wait(0.1)**
** game.Workspace.KillBrick.KillBrick.CFrame = CFrame.new(37.885, -169.59, 15.795)**
** game.Workspace.MAPS.map1.CFrame = CFrame.new(-329.95, 0.5, 0.965)**
** end**
** end**
** end**
** end**
** end**
end

1 Like

use either while loops or runservice loop
WHILE
RUNSERVICE

(runservice is better but a bit advanced)

3 Likes

In addition to a while loop, you could use a for loop when you’re counting down for efficiency.

while true do -- repeats forever

	for i = 10, 0, -1 do -- i starts at 10, loop runs until i <= 0, i gets subtracted by 1 each time the loop runs
		script.Parent.Text = i -- 10, 9, 8, etc.
		task.wait(1) -- waits 1 second
	end
	script.Parent.Text = "MAP CHOSEN" -- this will only run once the for loop ends

	-- do more stuff here

end
1 Like

MY EYES HELP-

Use RunService or a while loop.

2 Likes

Bro when i look back at this i understand why im blind.

1 Like
game.RunService:RenderStepped:Connect(function()

end)

better for looping