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

How to end for i loop which is inside while true do loop?

I am working on minigames game and I need help with loops. So I have while true do and inside is for i loop then end of for loop and game script. But when timer says 0 timer will reset and start again from 10. I tried everything, please help. Sorry for mistakes in code below but in a studio is everything okay.

Code: local GameStatus = rep:FindFirstChild("Values"):FindFirstChild("GameStatus") game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) --Loop-- while true do local count = 10 for i = 1,10 do if count == 1 then GameStatus.Value = "The next map will be chosen in 1 second" else GameStatus.Value = "The next map will be chosen in "..count.." seconds!" end count = count -1 wait(1) if count == 0 then break end end

----Next is map choosing and teleporting players--

end--End of the loop-- end)--End of character added-- end)--End of player added

4 comments

0

code blocks...

0

Stop making loops and make it a loop inside a function your script is clumped and the server isnt understanding what your actually want i have had the same problem

0

Also please put your script in lua format so i can help you with extra assistants

0

Use the break keyword.

1 answer

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