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

Quick question about how to do an infinite loop?

Asked by 5 years ago
Edited 5 years ago

So I have am making an Intermission bar in-game, and basically there's a stringVal in replicatedStorage and there's a TextLabel in a ScreenGUI that will update it to the current value of the stringVal. So what i'm confused about, is the script to update the value looks like this:

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

status.Value = "Intermission (1 Minute)"
wait(60)
status.Value = "Round In Progress (3 Minutes)"
wait(180)

But whenever the "Round In Progress" 3 minutes run out, it stays at Round in progress. I have tried making a value and setting it to "true" and adding this line of code

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

while game.ReplicatedStorage.Looper.Value == "true" do
status.Value = "Intermission (1 Minute)"
wait(60)
status.Value = "Round In Progress (3 Minutes)"
wait(180)

but that doesn't work. Can someone please explain how to make the top script repeat over and over

2 answers

Log in to vote
1
Answered by
Launderer 343 Moderation Voter
5 years ago
while true do
print("hello, i am the magical function of while true do, everyone hates me but I can be useful for you. la la la la")
wait()
end
0
Will that repeat? and do I just do "While true do" with no context? SBlankthorn 329 — 5y
0
that doesn't work /: SBlankthorn 329 — 5y
0
wait nvm ur right im just an idiot xD. Thanks 4 the help SBlankthorn 329 — 5y
Ad
Log in to vote
0
Answered by 3 years ago

Or you could just make a numValue and make the value INF which is a thing so it would be like this

script.Value.Value ---Go into the editor and manually change this to INF in the value section

Answer this question