Remote Event is not Firing!

Hello! I am Kamlkaze_Kid and I am trying to make an intermission where every player(Client) can see, and the text for each player is the same. I watched videos on RemoteEvents and read about them. I tried to make this work, but I think the Remote event is not firing. See for yourself:

-- Script in ServerScriptService
for i = 30, 1, -1 do -- this will count from 30 to 1 with -1 as the step.
    game.ReplicatedStorage.RemoteEvent:FireAllClients(i) -- Tell the client the current time
    wait(1)
end
-- local script, a parent of a text label
game.Workspace.Sound1:Play()
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(currenttime)
script.Parent.Text = "Welcome! A new map will be chosen in ".. tostring(currenttime)
end)

And there seems to be no error in output or script analysis. If you have questions, please ask.

2 Likes

My remote event is in ReplicatedStorage, and it is called “RemoteEvent”.

I don’t know if the server is not sending a signal, or the client is not picking up the signal.

Any errors? + I would like to mention ur system isnt effective. Instead of telling the client for every second to do something, u can just say to client u would like to start and then client handles counting down by himself.

Oh so like fire all clients and then on the local script, put the on client event, and the timer?

Also u dont need that massive wait inside of client listener… just delete it

So could you tell me what is wrong? I don’t know!

server:

game:GetService("ReplicatedStorage").RemoteEvent:FireAllClients()

client:

game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function()
    for i = 30, 1, -1 do
        script.Parent.Text = "Welcome! A new map will be chosen in ".. i
        wait(1)
    end
end)

I think sth like this

Then, why not check? Add print statements in the script & localscript to help narrow down potential issues.

pretty sure it works like

                                  '''
                   script.Parent.Text = "Welcome! A new map will be chosen in"..tostring(currenttime) 

‘’‘’

Maybe there is an issue with your GUI. I tried the code, it worked for me.

Any local scripts should use WaitForChild, so use

ReplicatedStorage:WaitForChild("RemoteEvent")

Some things load after local scripts run.

You don’t have to fire a remote for every client in the game 30 times for a countdown, just call :FireAllClients() once and connect the listener to a function which counts from 30 on the client.

local remote = game:GetService("ReplicatedStorage").RemoteEvent

local function OnClient()
      print("executing")
      for i = 30, 1, -1
      script.Parent.Text = "Welcome! A new map will be chosen in ".. i
   end
end

remote.OnClientEvent:Connect(OnClient)

Check your output, ‘executing’ should print once the event fires for clients.


Calling tostring() here isn’t necessary by the way, concatenating a number and string is legal.

Not always true, only when you’re sure where you’re indexing from will replicate before other objects (i.e through a LocalScript in ReplicatedFirst) otherwise anything under ReplicatedStorage replicates before LocalScripts execute.

1 Like

Unfortunately, the code doesn’t work and it doesn’t print “executing” either, but thanks for your trying!

It should work and you’re definitely doing something very incorrect here.
What scripts are you using for firing and receiving?

Use a ServerScript in ServerScriptService for firing for all clients (make sure players actually loaded in by that time) and a LocalScript containing the listener.

                                                                            '''
             --severscript
            game.ReplicatedStorage.Remote:FireAllClients()
        
           --local script
           local remote = game:GetService("ReplicatedStorage").RemoteEvent

     local function OnClient()
  print("executing")
  for i = 30, 1, -1
  script.Parent.Text = "Welcome! A new map will be chosen in ".. i
 end

end

     remote.OnClientEvent:Connect(OnClient)
      '''

I can’t quite understand by the formatting, but you left out the parenthesis while attempting to call Remote:FireAllClients().

Additionally, make sure players actually exist in the game before trying to fire for clients.
You only need to fire when you have to, but for perceiving it’s effect, try yielding at the beginning of the server script

wait(10)
-- code
-- assuming by 10 seconds you'll have loaded in

And any errors at all?

Edit: I also thought you said the remote was called ‘RemoteEvent’??

You’re trying to fire an inexistent event from the server and listening for another.

For some reason it still doesn’t work

Ok so I tried this:

                  '''
    -- SeverScript
   wait(5)  --wait for players to load 
    game.ReplicatedStorage.RemoteEvent:FireAllClients() 

   -- local script
   game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
   for i = 30,1,-1 do
   script.Parent.Text = "Welcome! A new map will be chosen in " .. i
   end

end)
‘’’

But it goes from 30 to 1 in less than seconds. How can i fix this?

You don’t have a wait(1), that’s why.

Do this instead:

for i = 30,1,-1 do
   script.Parent.Text = "Welcome! A new map will be chosen in " .. i
   wait(1)
end
1 Like