How do I receive the table from a RemoteEvent

@MakerDoe There should be two separately firing of the client, one for each of the players. Perhaps it is showing up as nil because you have attempted to consider both at the same time?

You should have both separately fired, as the for-loop is doing. then print the name one at a time.

1 Like

Bruh why is it still giving me a nil for the second player’s name.

So I should add a wait. Let me try this one

what are you trying to do? because i can send as many as i want in the table and i get them all.

Could you send us the client event? I want to make sure you are going through each player individually per firing

what is the client code you have right now?

1 Like

I highly recommend against using FireAllClients. If an error is thrown, your code won’t be ready to try again for that specific player, and in this specific case there’s another issue that will come up. Use FireClient, and wrap it in a pcall.

In your case here, you definitely don’t want to FireClient for anyone besides the imposters. Exploiters can and will write a script to detect who the imposters are. At no point in time can you let them have access to this info so easily.

4 Likes

Currently I’m trying to use the FireAllClients() I’m just testing it this time I added wait()

Well i don’t normally use remote events. i usually don’t use local scripts unless i have to.

@Extuls is completely right. If you were to fire all of the clients, and check which players are the imposters on the client instead of the server, exploiters could detect which players are the imposters.

1 Like

In addition to this i use scripts who can access server storage and using bindable events i am sure that exploiters can not read anything and then to send stuff to that specific player i use a remote event because last time i checked exploiters can not access other’s player gui’s

1 Like

i am gonna write some code in prevention for that then.

actually I already tried this but it keeps giving me a nil when getting the second player’s name
Screenshot_1

Could you send me the client event, the script that’s printing the names?

I believe your original code would work, but are you not considering each player separately in the local script? This should not print both at the same time. But rather, it should be printing something similar to:

07:55:58 -- fired
07:55:58 -- Player1
07:55:58 -- fired
07:55:58 -- Player2

sadly roblox is down right now so i can’t tell if the script i made is working or not:

I just changed it but I just use print(msg)

1 Like

Okay so if this doesn’t work then im confused.

i have tested this so its should work.

Baseplate.rbxl (23.0 KB)

Any way I found a solution that is working now, but the only thing is that its printing it twice or firing it twice server script:

gameTable.imposterTeammate = function()
	local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
	local imp1 = gameTable.imposters[1].Name
	local imp2 = gameTable.imposters[2].Name

	event:FireAllClients(imp1, imp2)
end

localscript:

local event = game:GetService("ReplicatedStorage").Events.RemoteEvent
local plr = game.Players.LocalPlayer.Name

event.OnClientEvent:Connect(function(imposter1, imposter2)
	if imposter1 == plr then
		print(imposter2)
	elseif imposter2 == plr then
		print(imposter1)
	end
end)

The reason for this is because you are firing the clients for each imposter. 2 imposters in the for-loop will make it fire all clients 2 times.

1 Like

I see so how do I make so that It will only fire once?

also as @Extuls said you are firing to all clients

What do you mean by that can you explain it to me?