FireAllClients Help

Hello Developers! I’m trying to do a script, I hope you can help me, I will now answer these questions, this is related to UIs.

  1. What do you want to achieve? Keep it simple and clear!
    I want to do a script. When you press a button it does visible a UI for all the players same to desactivate it.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching in the Devforum I found a topic, but I need more help with the script.

I’m trying to do a script of a Gui that it comes visible for all the players when you click a button, with a RemoteEvent, so it fires the RemoteEvent and the Gui comes visible to all the players. I hope you can help me.

Kindest regards,


Sometimes, A RemoteEvent relies on a FireAllClients. Most of the time, RemoteEvents are used for a lot. Since for a ScreenGUI, you’d need to make a remoteevent and make the event fireallclients, in order to make it appear.

Like this: SE:FireAllClients() ?

If you are trying to do :FireAllClients() on a client it won’t work. You will need to send the request to make a GUI visible to the server then have the server run :FireAllClients().

1 Like

Instead of using :FireAllClients, what you could do instead is put the GUI in the StarterGUI, where if the player joins the game, it will be added to their PlayerGui. Now make this ScreenGUI invisible, then fire the server, then on the script what you could do is:

   local players = game:GetService("Players")
   for _, player in ipairs(players:GetChildren()) do
        local GUI = player.PlayerGui:FindFirstChild("GuiNameHere")
        if GUI ~= nil then
            GUI.Visible = true

The code mentioned above is supposed to be in a regular script. Maybe place it in ServerScriptService.

It runs a loop through the players and finds the aforementioned GUI that you want to make it visible to everyone, then if it exists (exists, but not visible), then it will make it visible for everyone. Though you will have to use a Remote Event and place it in ReplicatedStorage, then fire it from a Local Script (which is where the button is)

If it doesn’t work, reply with the errors in the output window.

1 Like

So, this depends on what exactly you mean. When you say the above, do you mean only when you specifically press it, or when any player in the game presses it?

For the latter, here’s a solution:

  • Put 2 RemoteEvents in ReplicatedStorage
  • Have a script placed in ServerScriptService
  • Place a localscript somewhere inside StarterGui or inside of any folder/gui inside of it

In the script, do something like this:

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Variables
local remoteEvent1 = ReplicatedStorage:WaitForChild("remoteEvent1")
local remoteEvent2 = ReplicatedStorage:WaitForChild("remoteEvent2")

remoteEvent1.OnServerEvent:Connect:(function() -- Checks for when remoteEvent1 is received
    remoteEvent2:FireAllClients() -- Fires remoteEvent2 to all clients

And in the LocalScript have something like:

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Variables
local remoteEvent1 = ReplicatedStorage:WaitForChild("remoteEvent1")
local remoteEvent2 = ReplicatedStorage:WaitForChild("remoteEvent2")

local button = -- Path to the gui button
local gui = -- Path to the gui you want to make visible/invisible

-- When button is clicked, it fires remoteEvent1 to the server

-- When remoteEvent2 is received, it will make the gui visible
    gui.Visible = true

How this will work is, if anyone in the game clicks the button the following will happen in this order:

  1. The client clicks the button
  2. The client will fire remoteEvent1 to the server
  3. The server will receive remoteEvent1
  4. The server will then fire remoteEvent2 to all clients
  5. All clients will receive remoteEvent2
  6. All clients will make the specified gui visible

Let me know if this isn’t what you want, or just how it goes, or any questions!

1 Like

Two events aren’t necessary when it can be done with one only to lessen the objects in the game and makes it easier.

-- Server

-- Client

    -- make gui visible


Oh yeah, that’s true! Thanks for the input!

1 Like

Maybe do something like this:

--Server Script
local remote =

remote.OnServerEvent:Connect(function(player, ...)
    local args = {...}
    --maybe do some checks if the player can fire the event
local remote =
local guiToOpen =
local guiOpenDebounce = false

--Lets say we have a button as the parent of this

    if guiOpenDebounce then
        return -- so it can only open and close, instead of opening twice and closing twice, etc.
    guiOpenDebounce  = true
    guiToOpen.Visible = true
    guiOpenDebounce  = false
    guiToOpen.Visible = false

1 Like