I have three RemoteEvents that I fire on the server in a PlayerAdded function. On the client, I listen for these three remotes. They exist to give the client information about the state of the game when they first join.
However, the client is only actually receiving two of these remotes. For whatever reason, the OnClientEvent function never runs for the third remote. I have verified that the server is actually sending this third remote.
In my localscript where I listen for these remotes, if I connect to OnClientEvent for the third remote at the very top of the script, it is received. This is weird because all three connections are made at exactly the same time on the client, and all three RemoteEvents are fired on the server at exactly the same time. I’m completely at a loss as to why the client never receives the third one, but does receive the other two.
Server:
local function updateNewClients(player)
if Voting.CurrentVoting then
ReplicatedStorage.Remotes.Voting:FireClient(player, Voting.CurrentVoting)
ReplicatedStorage.Remotes.MapVotes:FireClient(player, Voting.MapVotes)
end
if Maps.Loading then
ReplicatedStorage.Remotes.LoadingInitiated:FireClient(player)
end
if GameModes.CurrentRound then
local info = GameModes.GetRoundInformation()
ReplicatedStorage.Remotes.RoundStart:FireClient(player, {
RoundInfo = GameModes.CurrentRound,
State = info.State
})
end
end
Client:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local Lobby = require(ReplicatedStorage.ClientModules.Ui.Lobby)
local Timer = require(ReplicatedStorage.SharedModules.Timer)
local Formatting = require(ReplicatedStorage.ClientModules.Ui.NumberFormatting)
local RoundController = require(ReplicatedStorage.ClientModules.Data.Round)
local Player = Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local CellRequest = ReplicatedStorage.Remotes.CellCount
local ClientCells, ServerCells
local left, startTime = 0,0
local CurrentTimer = nil
local function startTimer()
local hud = PlayerGui:WaitForChild("hud")
local start, serverTimeLeft = tick(), ReplicatedStorage.Remotes.Time:InvokeServer()
local timeLeft = (serverTimeLeft - (tick() - start))
left = timeLeft; startTime = tick()
CurrentTimer = Timer.new(timeLeft)
CurrentTimer.Second:Connect(function()
timeLeft = timeLeft - 1
local timeString = Formatting.GetTimeString(math.floor(timeLeft))
hud.tdm.MID.time.Text = timeString
end)
CurrentTimer.Finished:Connect(function()
CurrentTimer:Destroy(); CurrentTimer = nil
end)
end
ReplicatedStorage.Remotes.RoundStart.OnClientEvent:Connect(function(info)
print("round started")
RoundController.Intermission = false
RoundController.UpdateRoundInfo(info.RoundInfo)
Lobby.SetUi()
if info.State then
RoundController.UpdateState(info.State)
end
startTimer()
end)
print("round start connected")
ReplicatedStorage.Remotes.MapVotes.OnClientEvent:Connect(function(pool)
RoundController.VoteInfo = pool
Lobby.UpdateMapVotes()
end)
ReplicatedStorage.Remotes.Voting.OnClientEvent:Connect(function(pool)
if not Lobby.Voting then
Lobby.StartVoting(pool)
else --voting ended; sent chosen round data
Lobby.EndVoting(pool)
RoundController.VoteInfo = {}
end
Lobby.SetUi()
end)
print("voting connected")
The remote called RoundStart is the one that I’m having problems with. As you can see, Voting and MapVotes both fire at the same time that RoundStart does. They are both connected at the client at the same time. RoundStart is never received by the client in this configuration.