RemoteEvent not firing

My RemoteEvent is not firing from the client side when the event is fired from the server.
Here is my local script (in ReplicatedFirst):

print('began')
task.wait(3)
print('run')

game.ReplicatedStorage:WaitForChild('RemoteEvent').OnClientEvent:Connect(function()
	print('fired')
end)

The first two print() functions fire in the output and I am putting game.ReplicatedStorage.RemoteEvent:FireClient(game.Players.D3r3kM4n) into my console bar (on the server side of the F9 screen) but nothing happens. I even tried to run this in a script in ServerScriptService but nothing happened there either.
What may be happening and how can I fix this?

Does the RemoteEvent fire before the client finishes waiting?

print('began')
task.wait(3)
print('run')

If the server fires before the client is finished waiting then the client won’t receive the event.

It waits for it to finish. Also, the command prompt is after maybe 10 seconds of server runtime

What’s the server code look like

First of all… :FireClient() only works with localscripts… and second of all, i believe localscript can only run if it’s on a player character, player scripts, or playergui… and you said it’s on replicatedfirst?

Firstly,scripts should not be placed in replicated first,secondly put scripts in replicated storage

Also,server script service only allows servers to work,not client

The code you’ve provided in your post should work fine as long as the event is fired after the client has finished the wait time at the beginning of the LocalScript. What are you using this event for in your game? Knowing what you’re trying to accomplish would help.

I put the local script into both PlayerScripts and ReplicatedFirst. Plus, the Roblox description/documentation of a local script says that it will run even in ReplicatedFirst.

I was trying to make it so that the client’s camera moves to a position and I know that it cannot be done in the server but I need to make it so the server can control that.
Also, like I mentioned, the event is fired via F9 console on the Server tab. The time that I enter the command into the console is way beyond the time that the waiting finishes, signaled by the second print('run') function.

I don’t think putting localscript on replicatedfirst is a good idea… you’d be better off using bindableevent… or modules, maybe…?

How would I run the event from the server if it is a bindable event then?

I am not super experienced in using the f9 menu, but the command line seems to act strangely compared to Command bar in the View tab. If I try to do print("a") it does not print anything.
The code seems to work if I use the Command bar on the Server.


If I am not missing anything, I would think the problem is with the f9 menu, not your code.

I’m not sure if there is a problem with the F9 menu either, but a server script seemed to not work either.

Did you wait for the local script to finish waiting? Because this works for me:
image
Server script code

print("a")
wait(5)
print("b")
game.ReplicatedStorage.RemoteEvent:FireAllClients()

Your code

print('began')
task.wait(3)
print('run')

game.ReplicatedStorage:WaitForChild('RemoteEvent').OnClientEvent:Connect(function()
	print('fired')
end)

image
I used :FireAllClients() so I don’t need to pass a player value.

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