Possibility to Fire all Clients, except for one?


I was curious, for something like a player list where you don’t want the player to see themselves, I was curious if there was a way to…

  1. Fire all clients except for one,
  2. Fire from a client.

For a player list, why would you need to fire it from the server? You can get players from the client, too. If you really need to do this, you can loop through every player:

for _, v in pairs(game:GetService("Players"):GetPlayers()) do
     if v ~= playerYouDontWantToFireTo then
          someRemote:FireClient(v, yourData)

You can also just use FireAllClients and have the client who it’s not meant for ignore the request.

  1. There’s no method for it, but you can easily use a for loop and rule out the player you don’t want. posatta already typed out the code for it.

  2. You can fire from a client by using RemoteEvent:FireServer or RemoteFunction:InvokeServer:


Along with a connection server-side:

RemoteEvent.OnServerEvent:Connect(function(player, info) ... end)
RemoteFunction.OnServerInvoke = function(player, info) ... end

-- remote function can also be written like this:
function RemoteFunction.OnServerInvoke(player, info) ... end

The developer hub is a great resource for this: RemoteEvents, RemoteFunctions

The article on how to use those objects is also pretty good: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

1 Like

Going by your “player list” idea, you could do this.

--// Client
local remote = instance.new("RemoteEvent");
local players = game:GetService("Players");
remote.OnClientEvent:connect(function(otherarguments, playertoignore)
    if playertoignore ~= players.LocalPlayer then
        --// Code here

Realistically, you don’t even need a remote in this scenario. If you’re hiding something on the client, you can easily let the client handle that without interfacing with the server at all. If you need to replicate something to other clients but want to avoid receiving an event from the server, then you can use the filter method that posatta proposed.

1 Like

You can make a table with players and remove the one that you don’t want to fire.

Thanks everyone for their replies! That was just me trying to learn how to do that’s for some other features. Since multiple people used the same method, I’m just marking the first of those replies as the solution. Thanks again! :slight_smile: