Stopping while true do

hello, ive been trying to make while true do stop but it wont work, ive already went through fourms but nothing worked, is there anyway to fix this?

local playerService = game:GetService("Players") 
local RunService = game:GetService("RunService").Heartbeat:Connect(function()
end)
local players = {}
local Rep = game:GetService("ReplicatedStorage")
local Timer = Rep.Value


task.spawn(function()
	print("IntermissionHandler started.")
	while true do
		players = playerService:GetPlayers()
		if #players>1 then
			print("Enough players, starting intermission.")
			Rep.Values.RoundStatus.Value = "Intermission:"
			repeat
			task.wait(1)
			Timer.Value = Timer.Value - 1 
			wait()
			until Timer == 0
			return
		else
			task.wait(4)
		print("Waiting for more players...")
				end
			end
		end)

Rep.Values.RoundStatus.Value = "Round in progress..."
1 Like

should be until Timer.Value == 0

2 Likes

ill try that later, thank you very much

1 Like

try using break, i think it should work

1 Like

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