Problem With for loop

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

i want to make a game called “FuzzBuzz” Idea by: Augustus_Alderidge, Basically when the round starts you need to count up to whatever is the max number and if you dont say a number in order or like a word you basically not be in the round anymore and if the max number is 450 and the current number is 449 whoever said 450 wins, but im having a problem

  1. What is the issue? Include screenshots / videos if possible!

the issue is that the for loop dosent run the function, it just does the intermission again and again and it will never stop

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

i tried removing the waits and it still does the same problem

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

and also put a reply that also help the problem i will face when the OG problem is fixed

my script:

local PlayersInRound = {}

local Values = game:GetService("ReplicatedStorage"):WaitForChild("Values")

local Textlabel1 = Values:WaitForChild("Text1")
local Textlabel2 = Values:WaitForChild("Text2")
local NumberOn = Values:WaitForChild("NumberOn")
local PlayerValue = Values:WaitForChild("Players")
local MaxNumber = Values:WaitForChild("MaxNumber")
local RemainingPlayers = Values:WaitForChild("RemainingPlayers")
local Winner = Values:WaitForChild("Winner")
local TypedFirst = Values:WaitForChild("TypedFirst")

local function EndRound(Winner, TextLabel1, TextLabel2)
	TextLabel1.Value = Winner.." Has Won!"
	TextLabel2.Value = ""
	PlayersInRound = {}

local function StartRound(AmountPlayers, PlayersRemaining, RandomNumber, NumberOn, MaxNumber)
	if AmountPlayers >= 2 then
		while true do
			MaxNumber.Value = RandomNumber
			PlayersRemaining = AmountPlayers
			NumberOn.Value = 0
			Textlabel1.Value = "Round Started, Current Number is "..NumberOn.Value.." Type "..1 + NumberOn.Value.." On the chat box the Current Number Goes Up Until Someone types the max number."
			Textlabel2.Value = "Players Remaining: "..PlayersRemaining
			if game.ReplicatedStorage.Values.Winner.Value ~= "" then
			if game.ReplicatedStorage.Values.TypedFirst.Value ~= "" then
				Textlabel2.Value = game.ReplicatedStorage.Values.TypedFirst.Value.." Typed First"
			if NumberOn.Value == MaxNumber.Value - 1 then
				for i,v in pairs(PlayersInRound) do
						if m == tostring(MaxNumber.Value) then
							game.ReplicatedStorage.Values.Winner.Value = v
							EndRound(Winner.Value, Textlabel1.Value, Textlabel2.Value)
			elseif NumberOn.Value ~= MaxNumber.Value - 1 then
				for i,v in pairs(game.Players:GetPlayers()) do
						if m ~= tostring(NumberOn.Value + 1) then
							table.remove(PlayersInRound, i)
							Textlabel2.Value = v.Name.." Has Typed "..m.. "And its not "..1 + NumberOn.." And he/she is out of the game."
							game.ReplicatedStorage.Values.TypedFirst.Value = v

while wait() do
	for i = 15,0,-1 do
		Textlabel1.Value = "Intermission: "..i
		i = i - 1
		if i == 0 then
			Winner.Value = ""
			TypedFirst.Value = ""
			if PlayerValue.Value < 0 then
				Textlabel1.Value = "Not Enough Players"
				StartRound(PlayerValue.Value, RemainingPlayers.Value, math.random(50,2500), NumberOn.Value, MaxNumber)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

you should step through the code with the debugger, but I think the issue is probably with how you’re setting and/or checking PlayerValue.Value

make sure it’s actually >= 2 when StartRound is meant to start the round
maybe you set the value on local scripts and this script can’t see it, or maybe you arent setting it at all

In your while wait loop you put your increment to -1 therefor it would never reach 15 when its decreasing by 1 so instead of -1 put positive 1

Hope this helps

thank you with the solution but my mouse dosent work so when my dad comes home i will get to use his mouse so itg might take 2 hours

oh so i think it checking if its 2 i will put it 0 and test it, (by using my keyboard)

ok it fixed the issue and the other issues i was fixing, but i ran into another issue that the text dosent update it just stays the same

i tried adding a while loop but instead it broke the entire script

like nothing updates when the player says 1 the script detected the first player that said it and the script just does nothing

got the mouse its a logitech

you’re updating textlabels in replicatedstorage, not ones that players can see

oh i know the problem its the cript is setting the value to 0 when the thingy makes the point