Infinite yield possible warning for Remote Event

I wrote a Server and a Client script so that the server would send a message over to the client’s GUI and display a message there (all server-based). The GUI is not yet completed, but I believe the code should’ve still worked.

I’m getting a warning message saying:

ReplicatedStorage:WaitForChild(“startCountDownEvent”)

Here is my Server code:

local startCountDownEvent = Instance.new("RemoteEvent", replicatedStorage);
	startCountDownEvent.Name = "StartCountDownEvent";
	local startCountDown = replicatedStorage:WaitForChild("startCountDownEvent");
	
	-- Check to see if round has ended or not
	if roundEnded == true then
		-- If round has ended, start a countdown timer to start the next round
		-- Send a signal to the clients to start their local countdown
		print("TEST");
		startCountDown:FireAllClients(player, player.Startergui.screenMessage, "Countdown to next game... ", 25);

Here is my Client code:

local replicatedStorage = game:GetService("ReplicatedStorage");

-- Remote Events --
local startCountDownEvent = replicatedStorage:WaitForChild("startCountDownEvent");

-- Remote Event Functions --
local function startCountDown(gui, message, seconds)
	print(message .. seconds);
end

-- Listeners for Remote Event Server Fires --
startCountDownEvent.OnClientEvent:Connect(startCountDown);

Any help debugging this would be great.

On these lines, you make the name start with a capital “S”. However, you run a wait for child on a lower case “s”. Try changing that and see what happens.

1 Like

An infinity yield usually happens from a wait for child, use pcall(function)

1 Like

Bah. I feel so dumb now. Case-sensitive variable names always gets me.

Yeah that happens to me as well sometimes. Glad that it works now :slight_smile:

1 Like

Perfect. I just implemented a pcall(function) in there just in case something acted up. Thank you so much!