Did RemoteEvents break?

Hi everyone! While testing my game, I realized that my intermission system wasn’t working.
image

I thought it was just me accidently changing something, so I looked at my code. However, I couldn’t find any errors. This system fires to all clients during the countdown, so I tried to output something in my receiving local script. Nothing printed out.

In fact all my other remoteevents are also broken. They do fire eventually, but after 1-2 minutes, which is a huge delay.

Does anybody else have the same problem?

Can you show us the code? It would be better to analyze it.

for i=15,1,-1 do
	game.ReplicatedStorage.Events.IntermissionCountdown:FireAllClients(i)
	wait(1)
end

By the way, I just played the game again, and it works after the first round for some reason.

Can I see the listener of the remote event script?

game.ReplicatedStorage.Events.IntermissionCountdown.OnClientEvent:Connect(function(timeCount)
	local plrGUI = plr.PlayerGui
	local MainGUI = plrGUI:WaitForChild("MainGui",30)
	
	if MainGUI then
		local timer = MainGUI.InterM.Timer
		local title = MainGUI.InterM.Title
		local textbox = MainGUI.InterM.Text
		textbox.Text = ""
		title.Text = "Intermission"
		
		if math.floor(timeCount/10) == 0 then
			timer.Text = "0:0"..tostring(timeCount)
		else
			timer.Text = tostring(math.floor(timeCount/60))..":"..tostring(timeCount-60*math.floor(timeCount/60))
		end	
		
	end
end)

The bottom part of the script is just formatting(e.g. 15 seconds → 0:15)

I think I found something out. After about 30 seconds, the events are finally able to fire, and it’s almost like they are loading or something.

Try to use wait() somewhere in your code. I’ve had this issue and this fixed my problem.

1 Like

Try using :WaitForChild() when referencing the Events folder in ReplicatedStorage.

You might also want to replace game.ReplicatedStorage with game:GetService(‘ReplicatedStorage’)

1 Like

This is unrelated to the main topic but I’ve had the same problem, where only wait() seemed to fix code. However using RunService.Heartbeat:Wait() or RunService.Stepped:Wait() instead of wait() is much faster.

Ok guys, I think I found the issue, and it’s pretty silly. In the local script that I use to receive the remote event, this line is at the top:

local touchGui = plr.PlayerGui:FindFirstChild("TouchGui") or plr.PlayerGui:WaitForChild("TouchGui",30)

Only mobile players will have TouchGui, so basically my script would be waiting for 30 seconds before executing because of the “WaitForChild(“TouchGui”,30)” statement. If you were playing on PC, this WaitForChild would be an infinite yield without the 30 at the end.

Generally I shouldn’t be setting the timeOut value to such a high number, so that is a mistake on my part.

(By the way, I fixed the issue by checking if the player was on mobile through UserInputService and removing this WaitForChild command, but these topics are unrelated)