Remote Event Not Firing On Client

The issue is: when I fire the client, it doesn’t get triggered (I’ve used test prints, and everything printed out, except for when I got the to remote event trigger)

Example code (Server):

local Events = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents", 10)

local exampleEvent = Events:WaitForChild("EventName", 10)

exampleEvent:FireAllClients(randomParams)

Example code (Client):

local Events = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents", 10)

local exampleEvent = Events:WaitForChild("EventName", 10)

exampleEvent.OnClientEvent:Connect(function() print("Fired") end

Instead of it printing “Fired”; it prints nothing.

1 Like

if this is exactly how the code is written, theres a chance the server is firing the event before the client is loaded up and ready to receive the event thats fired. Try adding a wait(5) or something to the server and see if that works

The Local script of event must be in StarterPlayerScripts

Have you checked if there is an error,and isnt end supposed to be end)?

And also, you have a ,10 on the event, no clue why yoi have this, maybe remove it?

I am assuming that your example code is also what you are currently using, or is identical enough to how your real code is written.

The server will always fire RemoteEvents/Functions before a player gets to fully join. That means if the server is initiated, FireClient() and FireAllClients() will be called immediately. But, since the player still has to join, they won’t receive the event because they got in the game later than when the server called the aforementioned functions.

Therefore, try using Players.PlayerAdded:Wait() and task.wait(seconds) before you call FireAllClients().

Use Player Added event And do task.wait(2) and then FireAllClients

local Events = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents", 10)
local exampleEvent = Events:WaitForChild("EventName", 10)

game.Players.PlayerAdded:Connect(function(plr)
	task.wait(2)
    exampleEvent:FireAllClients(randomParams)
end)
1 Like

My remote events and scripts are placed correctly.

For any else who had this problem I’ll give a detailed solution.

When you fire the client on the server immediately, the players haven’t been registered in the game yet, so if call for example “Event:FireAllClients()”, there will be no clients to fire since a player haven’t been registered in the server yet. A way to get around this, if you want to immediately fire the event when a player joins, is to just do:

local PlayerService = game:GetService('Players')
local Event = 'Example (Replace Your Event Here)' :: RemoteEvent

PlayerService.PlayerAdded:Connect(function(plr)
	Event:FireClient(plr) -- Or you could do Event:FireAllClients()
end)

-- Or if you only want the event to be called once, do:
PlayerService.PlayerAdded:Once(function(plr)
	Event:FireClient(plr) -- Or you could do Event:FireAllClients()
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.