Why wont my StringValue update?

  1. What do you want to achieve? I’m trying to make a status bar that shows the intermission, game length and if there aren’t enough players to start.

  2. What is the issue? The status bar (StringValue in ReplicatedStorage) will only update the code in the for loops, but not the code before the for loops in the while loop. EDIT: The script works, the status just doesnt update.

--This is in ServerScriptService

local function roundSystem()
	while true do
		--This doesnt update:
		Status.Value = "Waiting for 2 Players"
		repeat wait(1) until players.NumPlayers >= 2
		
		-- This Updates the status:
		for i = interTime, 0, -1 do
			hasStarted.Value = false
			if i == 1 then
				wait(1)
				Status.Value = "Intermission: " .. i .. " Second left!"
			else 
				wait(1)
				Status.Value = "Intermission: " .. i .. " Seconds left!"
			end 
		end
		Status.Value = "Starting Game!"
		wait(3)
		-- Game Timer
		for i = gameTime, 0, -1 do 
			hasStarted.Value = true
			if i == 1 then
				wait(1)
				Status.Value = "Game: " .. i .. " Second left!"
			else 
				wait(1)
				Status.Value = "Game: " .. i .. " Seconds left!"	
			end
		end
	end
end

The Timer script in the ScreenGUI:

local Status = game.ReplicatedStorage.Status
local timer = script.Parent.Timer

Status.Changed:Connect(function()
	timer.Text = Status.Value
end)

Waiting for a response! :grinning:

you can remove the while loop and do it like that instead

function roundSystem()
		Status.Value = "Waiting for 2 Players"
		repeat wait(1) until players.NumPlayers >= 2
		
		-- This Updates the status:
		for i = interTime, 0, -1 do
			hasStarted.Value = false
			if i == 1 then
				wait(1)
				Status.Value = "Intermission: " .. i .. " Second left!"
			else 
				wait(1)
				Status.Value = "Intermission: " .. i .. " Seconds left!"
			end 
		end
		Status.Value = "Starting Game!"
		wait(3)
		-- Game Timer
		for i = gameTime, 0, -1 do 
			hasStarted.Value = true
			if i == 1 then
				wait(1)
				Status.Value = "Game: " .. i .. " Second left!"
                roundSystem()
			else 
				wait(1)
				Status.Value = "Game: " .. i .. " Seconds left!"	
			end
		end
	end
end

roundSystem()