How to pass 2 Variables in FireClient?

I have a Tool with a normal script which gets the tool holder = Player 1 and the other player which is caught in the raycast = Player 2. I want to FireClient for player 2 so a script could run for Player 2 but I cant add 2 Variables to FireClient because the code that runs when the remote is fired is to copy a value from a specific player which is Player 1. But how can I pass Player 1 and 2 To FireClient so Player2 value is the same as Players 1

2 Likes

Iā€™m a bit confused as of what you mean. This might help :thinking:

local RemoteEvent = game.ReplicatedStorage:FindFirstChild("Remote")

local function SendValues(Players,Data)
for _,player in pairs(Players) do
RemoteEvent:FireClient(player,Data) --Players is a table
end
end
end

-- do stuff here.
local player1 = game.Players:FindFirstChild("player1")
local player2 = game.Players:FindFirstChild("player2")
local Data = "Test Data"
SendValue({player1,player2}, Data) --Data is what ever you want to be shared with both clients.

If this does not help please edit your request, and add source code. :scroll:

2 Likes
remoteEvent:FireClient(1, 2, 3, 4, 5)

You can pass multiple values through a RemoteEvent by passing multiple values as arguments to its FireClient(), FireAllClients() or FireServer() instance methods.

3 Likes