FireClient or FireAllClients? What should I use?

I am doing some work for a training center, and I want to do a Host/Co-Host nametags.

When the Host Claims there session, by using :claimsession. then a nametag pops up saying Host.

When the Host picks a co-host with this command :setcohost then it gives the player a nametag that says Co-Host.

So should I use :FireClient or :FireAllClients? :confused:

1 Like

FireClient, you’re only choosing one client to be the host, not all clients.

I’m assuming you’re trying to set an overhead GUI for the Host and one for the Co-Host through a script? If so you’d probably want to do FireAllClients since you’re firing to the Client through the Server and want this name-tag to be seen by everyone, if I understood correctly.

1 Like

You should Use FireClient. When I was making my Murder Game, I used FireClient so when the server placed the knife or revolver in the user’s backpack, it would display a frame which read. You are the murderer or sheriff based on what weapon they had.

When I used FireAllClients every player would get the frame you are the sheriff or murderer.

1 Like

Yes, you don’t want the name tag to be client-sided, but when it comes to choosing the host, only one client can be chosen.

1 Like

FireClient fires to only one client, which is the first argument, while FireAllClients will fire to every client connected to the server.

2 Likes

If you want something to replicate to all clients then perhaps you’d want to just do it on the server?

Both ways wouldn’t work because new people who join the server won’t see it at all. The best thing to do is making it server sided.

But, the remote event is controlled by a client side script.
When the player chats, the remote event works.

Then you should be firing the server instead.

Ok.
[30charsplzwhyplzplsplspls]

When you fire the server, it automatically sends the first variable as the player who fired it, so you can work the script from there.

FireClient specifically calls to an individual player or players. For instance:
for _, player in pairs(game:GetService("Players"):GetPlayers()) do if player then Event:FireClient(player)

^ Notice how I had to define all existing players in pairs to Fire to each client

FireAllClients ignores the need to call to each individual player or in pairs, and instead fires to all clients using the same logic as in the example above.

1 Like