Something went wrong while trying to script my game teleporter

I’ve currently been trying to script a private game teleporter for my game that I’m working on, while scripting it I ran across an issue, I have an IntValue called QueueOnePlayerNum, which should reflect the amount of players in the first Queue, if the value is greater than or equal 4, then I wrote a function which plays if the value is greater than four, the function itself is working fine however my issues lies in that it only checks the value once, so as a test I set the value of QueueOnePlayerNum to 4 and the countdown function I wrote ran, however when I started the value out as 0, and then changed it to 4 after a couple seconds, nothing happened, I’ve only been using roblox studio for 3 months so I’m not sure what my problem is.

Screenshot_320

–local TS = game:GetService(“TeleportService”)

local QueueOneScreen = game.Workspace.QueueOne.QueueOneScreen.ScreenOne.ScreenOneGui.ScreenOneLabel
–local QueueOnePlayerNum = game.Workspace.QueueOne.QueueOnePlayerNum

local playersinqueueone = {}

local count = 30

local regionPart = workspace.QueueOne.QueueOneZone
local pos1, pos2 = (regionPart.Position - (regionPart.Size/2)), (regionPart.Position + (regionPart.Size/2))
local region = Region3.new(pos1,pos2)

local function countdown()
count = 30

local tracker = game.Workspace.QueueOne.QueueOnePlayerNum.Value
	
while tracker >=4 and count > 0 do
	
	local tracker = game.Workspace.QueueOne.QueueOnePlayerNum.Value
	
	if count >= 10 then
		QueueOneScreen.Text = "00:"..count
	else
		QueueOneScreen.Text = "00:0"..count
	end
	count = count - 1
	wait(1)

end
if count <= 0 then
QueueOneScreen.Text = “Teleporting…”

wait(1)
QueueOneScreen.Text = "Resetting.."
wait(1)
QueueOneScreen.Text = "00:30"
else
QueueOneScreen = "00:30"		
end

end

while true do

local tracker = game.Workspace.QueueOne.QueueOnePlayerNum.Value

if tracker >= 4 then

countdown()

end

wait(0.25)

end

Examples:
Function not running even after changing the value


Function runs if value is set to greater than 4 before the game actually is run

Note: The script isn’t finished ignore the region3 part, I’m currently trying to figure out an efficient way to detect when a player leaves the region3 so it’s unfinished

I had some trouble understanding your code, but I tried to reorganize it to the extent that I was able to understand. Hopefully this change works? (avoiding completely changing your code)

while wait(.25) do
	
	if QueueOnePlayerNum.Value >= 4 then
	
	countdown()
	
	break
	
	end
	
end

while wait() do
	if QueueOnePlayerNum.Value >= 4 and count > 0 then	
		if count >= 10 then
			QueueOneScreen.Text = "00:"..count
		else
			QueueOneScreen.Text = "00:0"..count
		end
		count = count - 1
		wait(1)
	elseif count<= 0 then	
		QueueOneScreen.Text = "Teleporting.."
		
		wait(1)
		QueueOneScreen.Text = "Resetting.."
		wait(1)
		QueueOneScreen.Text = "00:30"
		else
		QueueOneScreen = "00:30"		
		end
	end
end

Thanks for doing that, I’ll try it out.

local TS = game:GetService(“TeleportService”)

local QueueOneScreen = game.Workspace.QueueOne.QueueOneScreen.ScreenOne.ScreenOneGui.ScreenOneLabel
local QueueOnePlayerNum = game.Workspace.QueueOne.QueueOnePlayerNum

local playersinqueueone = {}

local count = 30

local regionPart = workspace.QueueOne.QueueOneZone
local pos1, pos2 = (regionPart.Position - (regionPart.Size/2)), (regionPart.Position + (regionPart.Size/2))
local region = Region3.new(pos1,pos2)

local function countdown()
while QueueOnePlayerNum.Value >= 4 and count > 0 do
if count >= 10 then
QueueOneScreen.Text = “00:”…count
else
QueueOneScreen.Text = “00:0”…count
end
count = count - 1
wait(1)
end
if count <= 0 then

	QueueOneScreen.Text = "Teleporting.."
	
		wait(1)
		QueueOneScreen.Text = "Resetting.."
		wait(1)
		QueueOneScreen.Text = "00:30"
	
	else
	QueueOneScreen = "00:30"		
	end
end

while wait(.5) do

if QueueOnePlayerNum.Value >= 4 then

countdown()

end

end

I still have the same problem, the values aren’t updating.