So, basically, I need to know how to loop my script. I'm making a countdown for my game, and it's actually important to the game. Here's the script I want to repeat:
--//Variables local DuelGUI = script.Parent.Parent local Script = script.Parent.DuelHandler local CountdownVal = script.Parent.Countdown local YesandNoFrame = script.Parent.YesAndNo local DuelTextText = script.Parent.DuelText local DuelStartingCountdownVal = script.Parent.DuelStartingCountdown local Player = script.Parent.Parent.Parent.Parent --//The coding part repeat wait() wait(1) CountdownVal = CountdownVal - 1 DuelTextText.Text = "Duel starting in "..CountdownVal "..." until CountdownVal == 0 if CountdownVal == 0 then DuelTextText.Text = "A duel is starting in "..CountdownVal " seconds. Would you like to enter? 5 players max." end repeat wait() wait(1) DuelStartingCountdownVal = DuelStartingCountdownVal - 1 DuelTextText.Text = "Duel in progress... "..CountdownVal " seconds left" until DuelStartingCountdownVal == 0 if DuelStartingCountdownVal == 0 then -- This part, I need to repeat end
On line 28, i need it to loop the script, or just loop from line 10 to 29 over and over again. But I don't know how to do it. While true do, perhaps? Here's a screenshot of where everything is located: https://bit.ly/2Y7IFL7 If anyone can help, please do. Thanks =)
Here
--//Variables local DuelGUI = script.Parent.Parent local Script = script.Parent.DuelHandler local CountdownVal = script.Parent.Countdown local YesandNoFrame = script.Parent.YesAndNo local DuelTextText = script.Parent.DuelText local DuelStartingCountdownVal = script.Parent.DuelStartingCountdown local Player = script.Parent.Parent.Parent.Parent --//The coding part repeat wait() wait(1) CountdownVal = CountdownVal - 1 DuelTextText.Text = "Duel starting in "..CountdownVal "..." until CountdownVal == 0 if CountdownVal == 0 then DuelTextText.Text = "A duel is starting in "..CountdownVal " seconds. Would you like to enter? 5 players max." end wait(1) DuelStartingCountdownVal = DuelStartingCountdownVal - 1 DuelTextText.Text = "Duel in progress... "..CountdownVal " seconds left" until DuelStartingCountdownVal == 0 if DuelStartingCountdownVal == 0 then while true do print("Looping...") wait(0.5) end end