Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make this script repeat to the beginning? To where it says intermission?

I know its really basic but i need help,

local status = game.ReplicatedStorage:WaitForChild("Status")
wait(15)
status.Value = "Intermission.."
wait(15)
status.Value = "Race will start soon!"
wait(5)
status.Value = "Cleaning track.."
wait(1)
status.Value = "Get in your Karts!"
wait(1)
status.Value = "Race starts in.."
wait(1)
status.Value = "3"
wait(1)
status.Value = "2"
wait(1)
status.Value = "1"
wait(1)
status.Value = "GO!!"
wait(5)
status.Value = "Race in progress.. join if you want to!"
wait(1)
status.Value = "Finish!"

2 answers

✓ Accepted answer

local status = game.ReplicatedStorage:WaitForChild("Status")

while true do
wait(15) 
status.Value = "Intermission.."
wait(15)
status.Value = "Race will start soon!"
wait(5)
status.Value = "Cleaning track.."
wait(1)
status.Value = "Get in your Karts!"
wait(1)
status.Value = "Race starts in.."
wait(1)
for i=3,1,1 do -- counts from 3 to 1
	status.Value = i
wait(1)
end
wait(1)
status.Value = "GO!!"
wait(5)
status.Value = "Race in progress.. join if you want to!"
wait(1)
status.Value = "Finish!"
wait(1) -- so it actually shows the Finish message
end

there are multiple ways for it to loop, ill give you some examples below.

the very common one: its seen in most old scripts afaik. its not the smoothest

while true do
wait()
--script here
end

renderstepped one: you need variables for it to work, its smooth afaik ok

local rs = game:GetService('RunService')
rs.RenderStepped:connect(function()
--script
end)

1 comment

0

For a basic game loop, always use a while loop. RenderStepped is used to run code as each frame is rendered (usually every 30th of a second).

This discussion is preserved as it was. New answers, comments, and votes are closed.