Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Count down for round timer is working but troubleshooting in output??

local txt = {"Time left until next round: "}

function startPr()
	for j = 300, 0, -1 do
		for i,v in pairs(game.Players:GetChildren()) do
			v.PlayerGui.ScreenGui.Frame.TextLabel.Text = txt[1]..j
		end
		wait(1)
	end
end

startPr()

20:32:25.161 - ScreenGui is not a valid member of Player

1 answer

EDIT: Just realised I made an error and did "WaitForChild" instead of FindFirstChild

I had the same problem earlier today. I'm assuming you're using R15, in R6, this would show no errors. My way to fix it was to wait for it to load so:

local txt = {"Time left until next round: "}

function startPr()
	for j = 300, 0, -1 do
		for i,v in pairs(game.Players:GetChildren()) do
			if v:FindFirstChild("PlayerGui") then
				if v.PlayerGui:FindFirstChild("ScreenGui") then
					v.PlayerGui.ScreenGui.Frame.TextLabel.Text = txt[1]..j
				end
			end
		end
		wait(1)
	end
end

startPr()

This discussion is preserved as it was. New answers, comments, and votes are closed.