Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
Ad
Log in to vote
0
Answered by 4 years ago

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)
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). FrogNinjaX 222 — 4y

Answer this question