Why is the loop not breaking

i want the loop to break once the value has reached 900
but its not breaking and keeps adding

while wait(1) do
	for _, player in pairs(game.Players:GetPlayers()) do
		local Quest = player:FindFirstChild("Quest")
		if Quest then
			local playTimeQuest = Quest:FindFirstChild("playTime")
			if playTimeQuest then
				playTimeQuest.Value += 1
				if playTimeQuest.Value >= 900 then
					break
				end
			end
		end
	end
end

Most likely you are using break inside the for loop. Hence, why it would continue looping the while loop.

could you tell me how to fix it instead of telling me what i MIGHT be doing wrong

It isn’t even what you might be doing wrong, it is what you’re doing around. Try to fix the problem on your own first, instead of posting less than a minute after.

i have tried for 30 minutes but cant figure it out

I meant to listen to their advice and try to find a way around it. If you have problems after trying, then feel free to ask.

You don’t need a break by the way, just check if their value is below a certain threshold before you add the value.

i figured it out had to put the loop within the playeradded function

What are you trying to accomplish with this? Are you trying to stop adding value to a certain player when they reach the max value? The description is too vague

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.