Local script not responding to OnClientEvent

I am firing a remote event (ReviveBack) from a server script to a player’s localscript, which is in PlayerScripts. I have confirmed that the remote event is firing from the server and the player which it is firing to is correct, but the localscript is not picking it up. Here is the code from the client.

game.ReplicatedStorage.ReviveBack.OnClientEvent:Connect(function(msg)

print(msg)

end)

Does anyone know why this wont work?

Could you show us the server side?

Also, you should use WaitForChild() when working on client like this:

local replicated = game:GetService("ReplicatedStorage")
local ReviveBack = replicated:WaitForChild("ReviveBack")

ReviveBack.OnClientEvent:Connect(function(Message)
    print(Message)
end)

the replicated storage is loaded in way before any localscripts run (unless they are in ReplicatedFirst), are you sure the code connecting the ReviveBack thing is actually running? it might be under an infinite yield.

do this by printing just before the OnClientEvent connection

print("ReviveBack is connecting on the client!")
game.ReplicatedStorage.ReviveBack.OnClientEvent:Connect(function(msg)
  print(msg)
end)

Seemed to be something like this, I moved the script around a bit and it started to work, it was probably due to loading times like @Valkyrop suggested, thanks, guys!