FireClient: player argument must be a Player object error

In short im trying to send over a value object to a local script from a server script. But i get this error: FireClient: player argument must be a Player object

Whats wrong?


local event = game.ReplicatedStorage.change

local numbers = script.Parent.TableVal

function leftClick()
	local clone = game:GetService("ReplicatedStorage"):WaitForChild("Table"):Clone()
	game.ReplicatedStorage:WaitForChild("Place"):WaitForChild("Chosen"):Destroy()
	clone.Parent = game.ReplicatedStorage:WaitForChild("Place")
	clone.Name = ("Chosen")
	event:FireClient(numbers)  --where it is erroring
end


script.Parent.MouseButton1Click:Connect(leftClick)
1 Like
Remote:FireClient(player, var, ...) -- You're firing the remote to specific player

The first argument is the target player you want to fire the remote.

Remote:FireAllClients(var, ...) -- You're firing the remote to all player

So player, var, numbers ?


Var is variable, it can be anything. For this case

event:FireClient(player, numbers) 
1 Like

Im getting an error line under player, but i cant define local player on a server script…

Should I just define player as local player

Who do you want to send the numbers to? All players or just a specific one?

1 Like

Well its sending the value to a local script inside a tool, so i assume specific player.

Where’s the script located under?

This script is in a gui button

Try to figure out how to define the player and also you can try another ways.

Do you know how I could define the player?

Sorry I’m confused could you elaborate?

Is this for a “ScreenGui” instance? You should be using a local script if so.

If for whatever reason you don’t have the player, just keep doing .Parent until you reach the player. Anything that handles a single player should have a method of retrieving them, too, but sometimes it’s unprepared.

You can’t use :FireClient() on a localscript, you can use bindableevents though for something like that, for more information about them look up “BindableEvent Roblox Devhub” on Google

The reason why it’s not working can be found here by reading this:
https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireClient

Yes, I think you can. Client to Client communication is possible.

It’s server to client.


hi uh not sure what you mean but

I think you need to first fire the remote event from the client to define the player.

(And very sorry for these spell mistakes, my language is different)

I tried firing player to the server script but could only do player added which didn’t work