Help with this error?

So, whenever a player joins I want the remote to fire to the client so the client can add a GUI for the player, however, I ran into this error while sending my event.

https://gyazo.com/ae570ec3c12b84ea65e5681fa9501394

Code:

Removed for leaking.

You have to specify a player to fire to. Change :FireClient() to :FireClient(Player)

2 Likes

Ah, I see, that fixed that problem, however, I am getting a new error.

https://gyazo.com/27fd442645162e1dac7806005ed0c1f9

Removed for leaking.

Also, you can use :FireAllClients() to send an update to every one. With this method you don’t need to specify a player and all arguments are passed to each client.

Line 41, you didn’t provide us enough information.

SETUP_TRACKER is just the remote event.

There is no player parameter on client-sided events because you can reference it with Players.LocalPlayer. Ex:

local PlayersService = game:GetService("Players")
local Player = PlayersService.LocalPlayer --only accessible from localscripts or modules required by localscripts

What about new players that join the game? FireAllClients() only fires to the current players in the game, and newly added players will be ignored. Also, this would require rank checking on the client which is not secure. (although, to be fair, if it is a UI the client already has access to it would not matter)

In general, this was the past code, and you can see what I am trying to accomplish.

Try to privde information in what sort of script the error is. like ServerScript or Localscript.

This is in a local script.

Removed for leaking.

You ccan’t get the player from OnClientEvent. Only from OnServerEvent in a serverscript to see what player fired it.

So how would I get the player from the server script to the local script? Is that even possible? And is there a alterative way?

Yes, FireClient(player, player) or FireAllClients(player)

1 Like